moonlight-stream / moonlight-qt

GameStream client for PCs (Windows, Mac, Linux, and Steam Link)
GNU General Public License v3.0
10.07k stars 586 forks source link

Intermittent video freezing #954

Open justinglavin opened 1 year ago

justinglavin commented 1 year ago

Describe the bug I understand there is a known issue with the NVENC encoder when Hardware Accelerated GPU Scheduling is enabled which causes frequent freezing of the video which requires the stream to be re-connected. Just video is frozen as I can still hear audio and control the host machine. The moonlight logs do not output anything when this happens.

I am observing that enabling/disabling HAGS is not the only variable which effects my freezing. For example, with HAGS enabled:

  1. With Hogwarts, I don't experience any freezing when streaming at a lower output resolution than 1440p
  2. Other games I am able to stream at 1440p or even 4k without any freezing (Valheim, Hi-Fi Rush)

The only way I can 100% prevent freezing with Hogwarts, is to either disable HAGS, or play at 1080p or lower resolution. I have also observed freezing with Cyberpunk 2077 but it is not as pronounced as Hogwarts.

With DLSS3 and Frame Generation making significant gains, I was hoping we could explore other workarounds or fixes that don't involve turning off HAGS. From my testing, the output resolution and DLSS upscale settings seem to come in to play.

Affected games

Client PC details (please complete the following information)

Server PC details (please complete the following information)

iloveicedgreentea commented 1 year ago

I also have been experiencing this issue with all resolutions and ALL bitrates down to 0.5. Last week it was fine and now it’s broken. Nothing in my setup has changed besides nvidia driver updates and steam deck os updates.

iloveicedgreentea commented 1 year ago

In my case at least enabling developer mode then disabling Wi-Fi power optimizations seems to have fixed the issue

justinglavin commented 1 year ago

Unfortunately WiFi power optimization doesn't seem to have an effect on my issue. I have also been testing with Ethernet vs WiFi and am still experiencing freezing.

Hitman006XP commented 1 year ago

I've the same issue. My sunshine host is a Win 11 Pro rig with i9-9900k, 32gb ram, NVME and RTX 3080 10gb and the latest Nvidia driver. My client is a Nvidia Shield TV Tube with the Moonlight App. Other games run perfectly fine (Wreckfest or Green Hell for example... all in 4k@60fps) but Hogwars Legacy freezes all the time. Sometimes it takes a second and sometimes a few steps/movements. Sometimes there are areas that run extremeley smooth but as soon as it get's into a minimal stutter scene the stream starts to stutter and very often freezes. I also can still hear the audio and control the host system. Lowering the Bitrate in Moonlight helps nothing... 1mbit or 80mbit always the same issue. DLSS/FSR also no impact. But if i change the resoltion to 720p it does not freeze or at least freeze extremely rare. But mostly always the stream is not really fluid... when it looks stuttery on Moonlight the PC in the other room runs it just fine and smooth. Right now i would call Hogwars Legacy unplayable with Moonlight+Sunshine on Nvidia GPU (not testet any other). I really hope this can be fixed soon.

Cloudbarrage commented 1 year ago

The same freezes happens with Nvidia game stream, subjectively it’s a little less common, but that could very well just be dependent on the places I was testing it on in Hogwarts.

I tried a bit more and set the game settings to all low while still streaming in 4k 60fps HDR and haven’t had a single freeze in the ~hour I tested, so that seems to be the workaround.

My guess is that some game settings might be turned up again, but that will require further testing.

phishsticks commented 1 year ago

I have this too! specifically on Hogwarts legacy. I have only tried 4k at this stage. Witcher 3 remaster and every other game I have tried works fine (most of the time).

My setup: 1gbps wired, Ryzen 5800x, RTX 3080TI 12GB, 16GB memory, Latest Nvidia driver with fresh install.

buthig666 commented 1 year ago

Turn off Hags in windows and restart. This greatly reduces Hogwarts freezing client side for me. I still have to restart moonlight every 2-3 hours of gameplay, but only for stuttering and not for a full freeze. I think the game is poorly optimized and nvidia uses Hags for Frame Generation, so ... I hate how I purchased a 4080 (strictly for streaming games) and I can't stream with FG on so far.

Chrisenkil commented 1 year ago

Turn off Hags in windows and restart. This greatly reduces Hogwarts freezing client side for me. I still have to restart moonlight every 2-3 hours of gameplay, but only for stuttering and not for a full freeze. I think the game is poorly optimized and nvidia uses Hags for Frame Generation, so ... I hate how I purchased a 4080 (strictly for streaming games) and I can't stream with FG on so far.

yep im having same issue i have a serie 40xx and cant use FB for the HAGS off on moonlight

asqw6677 commented 1 year ago

I have observed the same issue on FIFA23 and I have to turn off HAGS or else I experience random freezes. Both the host and client are using NVIDIA graphics cards.

shalak commented 1 year ago

I'm getting the same issue in Witcher 3 (on 4090), but only in game menus (and gwent), within the game itself it has never frozen.

oderwat commented 1 year ago

Same... Diablo IV and others. Worked perfectly in the past.

sebtoun commented 11 months ago

I'm experiencing quite similar issue with starfield but freeze is always recoverable (not sure how exactly). It seems to be related to playing some audio content. Typically somme dialogs are freezing the image. I found that completely uninstalling moonlight and then reinstalling (and pairing again) completely removes the issue... for a time. It eventually comes back either with time (few days) or with driver/client os updates. Are you able to fix (for a time) the issue by reinstalling? Not sure it's the same issue tbh. NVIDIA host + moonlight on steam deck client.

buthig666 commented 11 months ago

Turn off hags

x1000knives commented 10 months ago

Anyone have a different solution? I’ve tried turning off HAGS (or whatever it’s called now in Win11, but am still experiencing the video freezing. The quick fix is to just exit to the moonlight menu and resume streaming, but it gets repetitive having to do this at least once every 5 or so minutes.

Server/Host specs: -AMD RX 480 8GB (latest drivers installed) -Ryzen 5 3600 -Latest Sunshine nightly build -Wi-Fi 6 wireless adapter

Client specs: -Amazon Fire TV (Wired Ethernet, game mode enabled) -Latest version of Moonlight via Amazon App Store -720p-1080p streaming, 60FPS

Actual game performance is pretty good when all is working, especially compared to Steam Link, where the input lag is horrible.

sebtoun commented 10 months ago

Did you try sunlight 0.21 ? Some settings have been introduced about hags and freezing. I had to disable hags AND reduce resolution to 1080 in order to remove freezing. Using 600Mbps powerline adapter here.

x1000knives commented 10 months ago

Did you try sunlight 0.21 ? Some settings have been introduced about hags and freezing. I had to disable hags AND reduce resolution to 1080 in order to remove freezing. Using 600Mbps powerline adapter here.

Yes I’ve tried Sunshine 0.20, 0.21, and now the latest Nightly build. Issue has present on each version. I can try going back to 0.21 though to check those settings you’ve mentioned.

I am only streaming up to 1080p, but sometimes reduce it to 720p in Moonlight settings for a boost in performance, though the video will still sometimes freeze no matter what I do.

grannymaster commented 10 months ago

Same issue here. HAGS turned off. Running latest updates on everything.

PC specs:

I am trying to stream to my Samsung S23 Ultra which is connected to a WIFI6 AP.

According to gping I have stable 49-51ms ping between my PC and phone. Latency to my router or AP from my PC is ~1ms or lower.

x1000knives commented 10 months ago

Same issue here. HAGS turned off. Running latest updates on everything.

PC specs:

  • Ryzen 9 5900X
  • 32GB RAM
  • RTX 3080

I am trying to stream to my Samsung S23 Ultra which is connected to a WIFI6 AP.

According to gping I have stable 49-51ms ping between my PC and phone. Latency to my router or AP from my PC is ~1ms or lower.

I think I was able to resolve the issue on my end.

On my (Sunshine) Host: -disabled UPnP -Force AMD AMF/VCE -Set AMF Usage to lowlatency (fast)

On my Moonlight Client (FireTV) -Set default codec settings to Automatic (which I believe is now choosing HEVC, instead of H.264).

I was able to stream constantly today with absolutely zero freezing, and generally smoother gameplay than before. I’m not sure what the exact fix was here, but I think it may be a mix of using “lowlatency” instead of the default “ultralowlatency”, as well as using HEVC.

ClaytonRoques commented 2 weeks ago

Same issue here. HAGS turned off. Running latest updates on everything. PC specs:

  • Ryzen 9 5900X
  • 32GB RAM
  • RTX 3080

I am trying to stream to my Samsung S23 Ultra which is connected to a WIFI6 AP. According to gping I have stable 49-51ms ping between my PC and phone. Latency to my router or AP from my PC is ~1ms or lower.

I think I was able to resolve the issue on my end.

On my (Sunshine) Host: -disabled UPnP -Force AMD AMF/VCE -Set AMF Usage to lowlatency (fast)

On my Moonlight Client (FireTV) -Set default codec settings to Automatic (which I believe is now choosing HEVC, instead of H.264).

I was able to stream constantly today with absolutely zero freezing, and generally smoother gameplay than before. I’m not sure what the exact fix was here, but I think it may be a mix of using “lowlatency” instead of the default “ultralowlatency”, as well as using HEVC.

With it being about a year later, did you find that this fixed your freezing issues or did it require more tweaking? I've been trying to find a proper solution to this for quite some time now.

grannymaster commented 2 weeks ago

What fixed the issue for me was going for Ethernet. I had a spare USB-C to RJ45 adapter laying around, so when I'm connected over that, I have no issues. At the time I was using an oldish ASUS router in "AP Mode", maybe the router was just not good enough.