Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame rate drops when idle #3419

Open
2 tasks done
lcax200000 opened this issue Nov 25, 2024 · 19 comments
Open
2 tasks done

Frame rate drops when idle #3419

lcax200000 opened this issue Nov 25, 2024 · 19 comments

Comments

@lcax200000
Copy link

lcax200000 commented Nov 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the latest beta/pre-release?

None

Describe the Bug

I'm using sunshine and moonlight to stream games on a Windows 10 22H2 system. I noticed that when the system is idle on the desktop without any operation, the frame rate drops to less than 10 frames per second.
However, on Ubuntu under the same circumstances, it can even run at a full 240Hz frame rate.

I wonder if this is caused by the characteristics of the Windows DX API. Will upgrading to win11 help, Or which version of sunshine should I use?

Operating System Version

Windows10 22H2

Architecture

amd64/x86_64

Sunshine commit or version

024bd8f

GPU Model

RTX 4090

Relevant log output

[2024-11-25 11:48:32.138]: Info: Sunshine version: 0.0.0.dirty
[2024-11-25 11:48:32.139]: Info: Package Publisher: Third Party Publisher
[2024-11-25 11:48:32.139]: Info: Publisher Website: 
[2024-11-25 11:48:32.139]: Info: Get support: https://app.lizardbyte.dev/support
[2024-11-25 11:48:32.506]: Info: nvprefs: No need to modify application profile settings
[2024-11-25 11:48:32.506]: Info: nvprefs: Changed OGL_CPL_PREFER_DXPRESENT to OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED for base profile
[2024-11-25 11:48:32.686]: Info: Compiling shaders...
[2024-11-25 11:48:32.749]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.786]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.820]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.839]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.884]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.898]: Warning: include/base_vs.hlsl(28,13-36): warning X3556: integer modulus may be much slower, try using uints if possible.
[2024-11-25 11:48:32.898]: Info: Compiled shaders
[2024-11-25 11:48:32.909]: Fatal: ViGEmBus is not installed or running. You must install ViGEmBus for gamepad support!
[2024-11-25 11:48:32.910]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024-11-25 11:48:32.910]: Info: Trying encoder [nvenc]
[2024-11-25 11:48:33.183]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2024-11-25 11:48:33.184]: Info: Set GPU preference: 1
[2024-11-25 11:48:33.656]: Info: 
Device Description : NVIDIA GeForce RTX 4090
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002684
Device Video Mem   : 24142 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16374 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2024-11-25 11:48:33.656]: Info: Active GPU has HAGS disabled
[2024-11-25 11:48:33.656]: Info: Using realtime GPU priority
[2024-11-25 11:48:33.657]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024-11-25 11:48:33.658]: Info: Desktop resolution [2560x1440]
[2024-11-25 11:48:33.659]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024-11-25 11:48:33.659]: Info: Display refresh rate [240Hz]
[2024-11-25 11:48:33.659]: Info: Requested frame rate [60fps]
[2024-11-25 11:48:33.661]: Info: Creating encoder [h264_nvenc]
[2024-11-25 11:48:33.661]: Info: Color coding: SDR (Rec. 601)
[2024-11-25 11:48:33.661]: Info: Color depth: 8-bit
[2024-11-25 11:48:33.661]: Info: Color range: JPEG
[2024-11-25 11:48:33.916]: Info: NvEnc: created encoder H.264 P1 two-pass rfi
[2024-11-25 11:48:34.026]: Info: Creating encoder [hevc_nvenc]
[2024-11-25 11:48:34.026]: Info: Color coding: SDR (Rec. 601)
[2024-11-25 11:48:34.026]: Info: Color depth: 8-bit
[2024-11-25 11:48:34.027]: Info: Color range: JPEG
[2024-11-25 11:48:34.101]: Info: System tray created
[2024-11-25 11:48:34.206]: Info: NvEnc: created encoder HEVC P1 two-pass rfi
[2024-11-25 11:48:34.330]: Info: Creating encoder [av1_nvenc]
[2024-11-25 11:48:34.330]: Info: Color coding: SDR (Rec. 601)
[2024-11-25 11:48:34.330]: Info: Color depth: 8-bit
[2024-11-25 11:48:34.330]: Info: Color range: JPEG
[2024-11-25 11:48:34.527]: Info: NvEnc: created encoder AV1 P1 two-pass rfi
[2024-11-25 11:48:34.665]: Info: Creating encoder [h264_nvenc]
[2024-11-25 11:48:34.665]: Info: Color coding: SDR (Rec. 601)
[2024-11-25 11:48:34.665]: Info: Color depth: 8-bit
[2024-11-25 11:48:34.666]: Info: Color range: JPEG
[2024-11-25 11:48:34.868]: Info: NvEnc: created encoder H.264 P1 yuv444 two-pass rfi
[2024-11-25 11:48:35.450]: Info: 
Device Description : NVIDIA GeForce RTX 4090
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002684
Device Video Mem   : 24142 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16374 MiB
Feature Level      : 0x0000B100
Capture size       : 2560x1440
Offset             : 0x0
Virtual Desktop    : 2560x1440
[2024-11-25 11:48:35.450]: Info: Active GPU has HAGS disabled
[2024-11-25 11:48:35.450]: Info: Using realtime GPU priority
[2024-11-25 11:48:35.450]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024-11-25 11:48:35.452]: Info: Desktop resolution [2560x1440]
[2024-11-25 11:48:35.452]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024-11-25 11:48:35.452]: Info: Display refresh rate [240Hz]
[2024-11-25 11:48:35.452]: Info: Requested frame rate [60fps]
[2024-11-25 11:48:35.453]: Info: Creating encoder [hevc_nvenc]
[2024-11-25 11:48:35.454]: Info: Color coding: SDR (Rec. 709)
[2024-11-25 11:48:35.454]: Info: Color depth: 10-bit
[2024-11-25 11:48:35.454]: Info: Color range: JPEG
[2024-11-25 11:48:36.277]: Info: NvEnc: created encoder HEVC P1 yuv444 10-bit two-pass rfi
[2024-11-25 11:48:36.448]: Info: Creating encoder [av1_nvenc]
[2024-11-25 11:48:36.448]: Info: Color coding: SDR (Rec. 709)
[2024-11-25 11:48:36.448]: Info: Color depth: 10-bit
[2024-11-25 11:48:36.448]: Info: Color range: JPEG
[2024-11-25 11:48:36.657]: Error: NvEnc: gpu doesn't support YUV444 encode
[2024-11-25 11:48:36.758]: Info: Creating encoder [av1_nvenc]
[2024-11-25 11:48:36.758]: Info: Color coding: SDR (Rec. 709)
[2024-11-25 11:48:36.758]: Info: Color depth: 10-bit
[2024-11-25 11:48:36.758]: Info: Color range: JPEG
[2024-11-25 11:48:36.928]: Info: NvEnc: created encoder AV1 P1 10-bit two-pass rfi
[2024-11-25 11:48:37.087]: Info: 
[2024-11-25 11:48:37.087]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024-11-25 11:48:37.087]: Info: 
[2024-11-25 11:48:37.087]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024-11-25 11:48:37.087]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024-11-25 11:48:37.087]: Info: Found AV1 encoder: av1_nvenc [nvenc]
[2024-11-25 11:48:37.122]: Info: Configuration UI available at [https://localhost:47990
@lcax200000 lcax200000 changed the title The relationship between Power Options and frame rate Frame rate drops when idle Nov 25, 2024
@ReenigneArcher
Copy link
Member

This looks like you're using a self compiled version. Please update your issue with the commit you're using.

@lcax200000
Copy link
Author

lcax200000 commented Nov 26, 2024

This looks like you're using a self compiled version. Please update your issue with the commit you're using.

I have updated the commit version.

After upgrading to win11 24H2 and using WGC (manually starting sunshine), there are still only 9 frames in idle time

image

@ReenigneArcher
Copy link
Member

I'd suggest trying the latest pre-release. There have been many commits since the one you linked.

@ReenigneArcher
Copy link
Member

There's also a config option to min_fps_factor, you can set that from 1-3. 3 will result in a higher FPS when content is idle/mostly static.

@lcax200000
Copy link
Author

There's also a config option to min_fps_factor, you can set that from 1-3. 3 will result in a higher FPS when content is idle/mostly static.

Even when I try to set minimum_frame_time to 1MS, it won't go up to 64fps

@LibertyGM
Copy link

@ReenigneArcher , Excuse me, can you tell me, when will Sunshine be released? A lot of time has passed since the last release. Can you tell me when a stable release is planned?

@mrotame
Copy link

mrotame commented Dec 18, 2024

I'm having the same problem. I'm using the latest pre-release version v2024.1218.135629, and no matter the value I use in minimum_frame_time, the FPS doesn't change.

Having both a PC monitor and a smartphone with 120 FPS, games locked with 60 FPS are unplayable due to constant stuttering every ~1.5 seconds

The workaround I found for my problem, is to keep any small video/animation rendered in 120+ FPS running in the corner of the screen to force the stream back to 120 FPS

@lcax200000
Copy link
Author

I'm having the same problem. I'm using the latest pre-release version v2024.1218.135629, and no matter the value I use in minimum_frame_time, the FPS doesn't change.

Having both a PC monitor and a smartphone with 120 FPS, games locked with 60 FPS are unplayable due to constant stuttering every ~1.5 seconds

The workaround I found for my problem, is to keep any small video/animation rendered in 120+ FPS running in the corner of the screen to force the stream back to 120 FPS

minimum_frame_time is only effective if the frame drops after the screen is still.
What FPS can you reach when playing games?

@momala454
Copy link

i confirm min_fps_factor is not working. I've set to 3, and it drops from 120fps to 20fps when idle.
If I then move the mouse very fast, i see a big compression artifact and the mouse stutter during a short time
i'm using the latest pre release

@mrotame
Copy link

mrotame commented Dec 19, 2024

minimum_frame_time is only effective if the frame drops after the screen is still. What FPS can you reach when playing games?

Normally the stream reaches constant 120 frames if something is being rendered with 120 FPS or more.
The stream usually starts with 120 frames, when it is still initializing, then it drops to ~60 or less (depending of what is being rendered in the screen)

@lcax200000
Copy link
Author

i confirm min_fps_factor is not working. I've set to 3, and it drops from 120fps to 20fps when idle. If I then move the mouse very fast, i see a big compression artifact and the mouse stutter during a short time i'm using the latest pre release

If not set, it will drop to 9fps

@lcax200000
Copy link
Author

minimum_frame_time is only effective if the frame drops after the screen is still. What FPS can you reach when playing games?

Normally the stream reaches constant 120 frames if something is being rendered with 120 FPS or more. The stream usually starts with 120 frames, when it is still initializing, then it drops to ~60 or less (depending of what is being rendered in the screen)

Yes, me too. The mouse movement is slow when the connection is just established.

@mrotame
Copy link

mrotame commented Dec 20, 2024

If not set, it will drop to 9fps

In my case, no matter the value I use (1, 2, or 3) it drops to 9 FPS when idle (or to 60 when I'm playing a 60-locked game

This would not be a problem, but the stream is stuttering every ~1.5, ~2 seconds when this happens.
I've tested other streaming services, and I confirmed it's not happening to them.

@ReenigneArcher
Copy link
Member

In my case, no matter the value I use (1, 2, or 3) it drops to 9 FPS when idle (or to 60 when I'm playing a 60-locked game

That doesn't sound right. Did you restart Sunshine after applying the change (Sunshine does not re-read the config after startup)? What version of Sunshine are you using?

In any event, the setting will not really give you a floor of 60fps, more like ~30.

If you're getting 9 fps with this setting at 3, you have something else going on. Perhaps network issues, or something else completely. This issue is also about static content, such as sitting at the desktop screen or a menu with no animations. If you're in the middle of a game and having this, it's an entirely different thing.

Can't really tell more without logs. If you need more support please reach out on Discord or use our discussions feature https://github.com/orgs/LizardByte/discussions

@momala454
Copy link

is there any possibility to avoid the fps/bitrate to go low when idleing ?
i don't care about the bandwidth usage

@mrotame
Copy link

mrotame commented Dec 20, 2024

That doesn't sound right. Did you restart Sunshine after applying the change (Sunshine does not re-read the config after startup)? >What version of Sunshine are you using?

I’m using the latest pre-release version: v2024.1217.154237. Yes, I’ve restarted Sunshine, my computer, and Moonlight as well.

If you're getting 9 fps with this setting at 3, you have something else going on. Perhaps network issues, or something else completely. This issue is also about static content, such as sitting at the desktop screen or a menu with no animations. If you're in the middle of a game and having this, it's an entirely different thing.

I get 9 FPS when idle (e.g., on the desktop or with static images). However, when playing, the stream matches the game’s FPS, up to a maximum of 120 FPS.
When playing at ~120 FPS, everything works perfectly—no lag, no stuttering, no issues at all. The problem occurs only when the game is locked to 60 FPS or when nothing running at ~120 FPS is being rendered on my computer screen.


I believe I’ve discovered new information about my stuttering issue.

I ran some tests with Path of Exile 2. While streaming to my phone, I can achieve ~115–120 FPS without any stuttering or lag. The streaming is completely smooth. However, when I lock the FPS to 60, stuttering begins. This also occurs when streaming Switch games, which are capped at 60 FPS.

I attempted to record my phone screen to demonstrate the problem, but the stuttering disappeared while recording. As soon as I stopped recording, the issue returned.

To investigate further, I used my wife’s phone to record both my PC and phone screens. That’s when I noticed my phone screen was flickering significantly, while my PC screen remained stable. It seems my phone uses a dynamic refresh rate, and when Moonlight streams at 60 FPS, my phone reduces its refresh rate from 120 Hz to 60 Hz. This adjustment appears to cause stuttering every 1.5 seconds.

I also tried locking Moonlight to 60 FPS, but it didn’t resolve the issue. Additionally, adjusting the min_fps_factor setting had no effect on the stream.

@mrotame
Copy link

mrotame commented Dec 20, 2024

Is the min_fps_factor setting supposed to force the stream to run at maximum FPS?
If not, is there a way to achieve this? Currently, I’m forced to use Parsec and steam-link to play 60 FPS-locked games while I can't find a solution to this problem

@ReenigneArcher
Copy link
Member

There's no minimum_frame_time config option. It's min_fps_factor. This influences the fps floor (minimum FPS). Setting to 1 is roughly equal to 10 FPS, 3 is roughly equal to 30 FPS, but it is not a linear relationship.

@mrotame
Copy link

mrotame commented Dec 21, 2024

I confused the name earlier it’s actually min_fps_factor.
Unfortunately, this feature doesn’t solve the author’s issue, nor does it solve mine.

Is there any chance we have a "force maximum frame rate" option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants