obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.1k stars 7.96k forks source link

OBS causes frametime stuttering #8929

Open 1kuna opened 1 year ago

1kuna commented 1 year ago

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

29.1.1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/czZELh0u3TKsJ5O0

OBS Studio Crash Log URL

No response

Expected Behavior

No frametime variation by having the application open.

Current Behavior

I get choppy frametimes when OBS is open. I even tried removing all sources and disabling preview while not recording and the issue still happened. This occurred while HAGS was on and off. Tried adding an exception to defender, running as admin, & setting a lower priority/affinity and that also did nothing. I measured the issue using Blur Busters' timing deviation test. The issue only happens when I have OBS open, I even tried recording with Shadowplay and got nothing but green floor.

Here's an image showing the inconsistent frame timings.

Steps to Reproduce

  1. Open OBS
  2. Minimize the application without recording, disable preview and remove any sources if necessary.
  3. Enable hardware acceleration on Google Chrome and run the browser test.
  4. Unless you have something else causing issues (like RGB software, commonly) you should have a "green floor" which means perfect frame pacing/timing.
  5. If nothing is causing timing issues when OBS is closed, you should see red spikes as I am when OBS is open

Anything else we should know?

No response

energizerfellow commented 1 year ago

Since you're using Display Capture and not Window Capture, this is likely a byproduct of how Desktop Window Manager (DWM) works at a technical level in Windows. DWM's tick rate will be whatever the highest monitor's refresh rate is and will judder and/or drop frames in attempt to sync with the other monitor's lesser/different rates. You'll also notice the vast majority of those peaks match the wall clock time of you primary monitor's 360 hz refresh rate at 1 / 360 ~= 2.8 ms.

1kuna commented 1 year ago

@energizerfellow I don't mean to be rude when I say this, but I'm not sure if you saw where I said: "I even tried removing all sources and disabling preview while not recording and the issue still happened."

Screen capture, window capture, game capture, no sources, no audio, it still happens. Literally nothing happening except the application itself being open is causing it.

zzzlach commented 1 year ago

Gonna give this a bump. Been experiencing the same myself, and nobody has responded in both the discord and the forums, so hopefully someone on here will know what's going on soon.

Additionally - what GPU do you have? I found someone else in the discord who'd had the issue and they said they had a 4070. I have a 4080, and if you also have an NVIDIA 4000 series GPU, we'd have a clear pattern.

Edit #2: Talked with a few people having the same issue and they all had 4000 series cards. Interestingly enough, when I set up a second monitor and dragged OBS over to it, the stuttering stopped and all was well. Think it might have something to do with the 4k series cards and having OBS displayed on the same monitor, though I'm not a tech wiz and can't say for sure that's what's going on, but for the devs I'd say it's a good place to start.

Kobi-Blade commented 1 year ago

Try disabling Windows MPO.

1kuna commented 1 year ago

@Kobi-Blade I have a 4070 Ti for context. I disabled Windows MPO and it seemed to reduce the frametime peaks to a burst every few seconds except for constantly, though this is preliminary and I haven't retested it with MPO re-enabled. As for what @zzzlach said about moving OBS to a second monitor, I always have it minimized on my second monitor. As stated in the original post it'll cause the issues even if I'm not recording anything, even if preview is off, even if it's minimized, and even if I don't have any sources/audio set up. Not sure what the deal is but it seems like an OBS thing. I'm perpetually recording with Shadowplay instant replay and haven't had a single frametiming inconsistency with it, but the second OBS is opened, the peaks appear.

RytoEX commented 1 year ago

Could you please retest with OBS Studio 29.1.2 and let us know if the behavior changed at all?

Could you please also confirm if you have VRR/G-Sync enabled? What happens if you toggle it to the opposite state?

1kuna commented 1 year ago

@RytoEX currently using 29.1.2 and it's been the same for the past few updates (from when I initially started testing). I've tried toggling both Windows VRR and G-Sync interchangeably (all combinations, including HAGS) and there was no improvement. Having G-Sync enabled at all actually made the timing worse (more inconsistent), which I believe is normal considering it's dynamically adjusting refresh rate, thus causing inconsistency in the frame intervals.

With that being said, the best case scenario so far was to disable G-Sync entirely. This is something that would've already been done considering G-Sync makes timings inconsistent by nature, which was anecdotally proven when using the same tool initially mentioned.

energizerfellow commented 1 year ago

I don't mean to be rude when I say this, but I'm not sure if you saw where I said: "I even tried removing all sources and disabling preview while not recording and the issue still happened."

Screen capture, window capture, game capture, no sources, no audio, it still happens. Literally nothing happening except the application itself being open is causing it.

You can reproduce the issue without OBS in Windows if you have any kind of animation running on multiple monitors at once (so much as a toaster popup from the system tray counts). This is especially if the multiple monitors are running at refresh rates that aren't integer multiples of each other due to judder. Running a frame pacing sample on one monitor while watching a Youtube video on the other would be a typical test.

Note that >3x multiple difference between refresh rates, e.g. 6x of 360 hz vs 60 hz, may be broken and any kind of VRR being enabled would likely make this even worse. Fullscreen Exclusive (FSE) mode on pre-DX12 games may be an issue, as could Fullscreen Optimizations.

1kuna commented 1 year ago

@energizerfellow done that. Ran the frame pacing test on my main monitor while running a buncha stuff in the background, clicking around on my second monitor and using it normally, left all my normal programs open, perfectly green across the board with the very occasional tick of yellow. Open OBS, even minimized and having zero sources as I mentioned, nothing but red spikes.

Doesn't make sense to blame it on everything except OBS when it only happens with OBS open. In the message above I speak about how I've tried all sorts of variations between G-Sync and VRR. I also played around with HAGS and none of the combinations resolved the issue. I also tried both enabling and disabling fullscreen optimizations for the games I was using. Didn't matter either way because even when I launched in safe mode with zero other applications running, OBS still caused frame time issues with just itself and an incognito Chrome tab open with the frame pacing test.

OBS closed: Little to no inconsistent pacing OBS open: Consistently inconsistent pacing

I feel like the least common denominator is just OBS, no?

RytoEX commented 1 year ago

@energizerfellow done that. Ran the frame pacing test on my main monitor while running a buncha stuff in the background, clicking around on my second monitor and using it normally, left all my normal programs open, perfectly green across the board with the very occasional tick of yellow. Open OBS, even minimized and having zero sources as I mentioned, nothing but red spikes.

Doesn't make sense to blame it on everything except OBS when it only happens with OBS open. In the message above I speak about how I've tried all sorts of variations between G-Sync and VRR. I also played around with HAGS and none of the combinations resolved the issue. I also tried both enabling and disabling fullscreen optimizations for the games I was using. Didn't matter either way because even when I launched in safe mode with zero other applications running, OBS still caused frame time issues with just itself and an incognito Chrome tab open with the frame pacing test.

OBS closed: Little to no inconsistent pacing OBS open: Consistently inconsistent pacing

I feel like the least common denominator is just OBS, no?

Could you please try your test of just opening OBS with a couple of our CI builds? I'd be curious if the behavior is different at all with either of these.

Kobi-Blade commented 1 year ago

I don't mean to be rude when I say this, but I'm not sure if you saw where I said: "I even tried removing all sources and disabling preview while not recording and the issue still happened." Screen capture, window capture, game capture, no sources, no audio, it still happens. Literally nothing happening except the application itself being open is causing it.

You can reproduce the issue without OBS in Windows if you have any kind of animation running on multiple monitors at once (so much as a toaster popup from the system tray counts). This is especially if the multiple monitors are running at refresh rates that aren't integer multiples of each other due to judder. Running a frame pacing sample on one monitor while watching a Youtube video on the other would be a typical test.

Note that >3x multiple difference between refresh rates, e.g. 6x of 360 hz vs 60 hz, may be broken and any kind of VRR being enabled would likely make this even worse. Fullscreen Exclusive (FSE) mode on pre-DX12 games may be an issue, as could Fullscreen Optimizations.

That is caused by MPO, and OP already disabled it and had little success solving the issue. OBS issues with VRR are long standing, I've also had issues with Freesync and OBS.

s3gfaultx commented 9 months ago

I'm experiencing this exact same issue on Linux (Archlinux 6.6.10) running KDE Plasma under Wayland.

Seems just running OBS, without any sources causes a stutter approx once per second. You can see just by moving the mouse pointer on the desktop, it's like it just rewinds or stops for a few frames and then continues. Using tools like mangohud, you can even see the spike while in game.

I'm using Freesync at 165hz on my primary monitor and it's supported by 2 other monitors both running at 60hz. |

Let me know if there is anything else I can add to help test, debug, or fix this issue.