LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
16.07k stars 776 forks source link

Unable to capture FPS faster than refresh rate #2195

Open trudnorx opened 4 months ago

trudnorx commented 4 months ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the nightly release?

Describe the Bug

Say a game is consistently running at X fps (higher than Y and Z), Sunshine is asked to deliver Y fps, which is higher than monitor refresh rate of Z Hz. Sunshine proved unable to deliver any frame rate higher than Z. Only while moving the cursor did Moonlight report a FPS of Y being delivered, but this was of little value to the user because the game kept being actually delivered at Z FPS (perhaps only the cursor was updating faster?). A test on the same machine with OBS being asked to capture Y FPS proved that OBS game capture was able to successfully record the game at an actual rate of Y FPS.

Expected Behavior

No response

Additional Context

No response

Host Operating System

Windows

Operating System Version

-

Architecture

32 bit

Sunshine commit or version

0.21.0

Package

Windows - installer

GPU Type

Nvidia

GPU Model

-

GPU Driver/Mesa Version

-

Capture Method (Linux Only)

No response

Config

-

Apps

No response

Relevant log output

-
Originalimoc commented 4 months ago

Your cursor is drawn by GPU. The main frame is copied from (dwm?). OBS is probably using a different API, can it record UAC prompt?

Slashic commented 4 months ago

OBS has a different method of capture, akin to Steam remote play, they can capture the DX/GL render target window instead of the whole framebuffer, this has several advantages like not being bound to the monitor refresh rate/aspect ratio and perfectly reproduce adaptive sync on the client using variable frame rate.

This could be a nice feature added to Sunshine but not an easy one to implement for sure.

Nonary commented 3 months ago

Sunshine will capture the frame rate of the game, the refresh rate of the host does not matter at all. You most likely have vsync enabled, which causes the game to render at a lower frame rate. Or the game itself is rendering at a lower frame rate, due to the way how Sunshine captures the game there is no way for us to fix this.

Other products that captured at a constant frame rate had microstuttering problems due to uneven frames.

Nonary commented 3 months ago

FWIW, once https://github.com/LizardByte/Sunshine/pull/2149 is completed there is an option for constant capturing rate which would "fix" this issue, but you'll notice microstuttering problems due to uneven frame pacing like i mentioned before, so I am skeptical this is even possible to resolve.

trudnorx commented 3 months ago

You most likely have vsync enabled, which causes the game to render at a lower frame rate.

Pls read what I stated carefully. The game is successfully rendering at a higher FPS than the monitor's refresh rate, but Sunshine fails to capture anything higher than the refresh rate. Unlike OBS.

LizardByte-bot commented 3 days ago

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!