Question / Help OBS preview stutters while not recording

darthclide

Member
My OBS output is set to 60fps, and my game is running at 60fps. Every 10-15 minutes my preview appears to be 30-40 fps for about 45 seconds, then goes back to normal. This is WITHOUT recording. Simply just sitting there. But as soon as the stutter comes, I can fix it by swapping my output fps to 59.94 (which fixes the stutter) and back to 60fps (the stutter is gone, and looks fine). Obviously I can't do this swap while I am streaming.

This occurs on 2 completely different machines. 1. Has a GTX 970, and a 3930k processor. 2. Has an RTX 2070 and a 8700k processor.
It happens on an 1804 version of Windows. An 1809 (with all updates) version of Windows. As well as an 1803 version of Windows.

Can someone here please help me get to the bottom of this?

Log shows nothing obviously since I am not even recording.
https://obsproject.com/logs/bZqGjKBXDIus42ea
 

Ken Ishizu

New Member
Hi there! This sounds exactly like the issue some of us have been facing for a long time. There are several threads about this particular issue, but it seems no one managed to find a fix for this.
https://obsproject.com/forum/thread...preview-which-goes-into-recorded-videos.77744
https://obsproject.com/forum/threads/frame-rate-is-cut-in-half-stutters-every-10-minutes.39269

From what I've understood, this problem is external to OBS. The same stutter shown in the preview every 10-15 minutes also goes into the recorded videos and, at least in my case, no lagged / skipped frames are logged by OBS. It seems there's some kind of prioritization bug involving Windows DWM or DirectX, that results in the capture of duplicated frames by "background" processes like OBS. These repeated frames are the source of the 'stutter'.

I even tried fiddling with the OBS source code, specifically the parts which affect the 'Desktop Capture' (Desktop Duplication API), but it only made things worse. From my testings, I concluded that everything that uses DirectX 11 to hook / capture frames (Game / Window / Display Capture) would eventually begin stuttering after some time.

Maybe the use of a different source, like acquiring frames of a capture card through DirectShow, will bypass this issue. But I'm not 100% sure about this...
 

darthclide

Member
Well for me the stutter happens with any kind of capture: Window Capture, Game Capture, or Desktop Capture. And sadly I have only received the run around with OBS support (To be fair, the support can really only answer your simple "how do I stream" and "why are my frames dropping" kind of questions). After all my testing, I am convinced it is some issue related to drivers, Windows, and OBS interacting in a bad way. While drivers will vary wildly and can't be controlled much, I have to believe that Microsoft could work with OBS to solve this.

Xsplit has EXACTLY the same problem for me. And while xsplit worked with me trying different ideas, their final suggestion was to replace the graphics card. If we could manage to get OBS and Xsplit to reach out to Microsoft, then perhaps something can happen?
 

Ken Ishizu

New Member
Same here. I see the stuttering in Game Capture, Windows Capture and Desktop Capture as well, every 10 or 15 minutes in any game I play. That's why I think it's related to DirectX 11.

Other guys in those threads I linked earlier tried tweaking literally everything to solve this, but nothing worked in the end. The common denominator of all who reported this exact problem was: Nvidia cards and single PC setup for gaming & streaming / recording.

What I'm still trying to figure out is why it seems like only a few individuals are complaining about this stuttering 'bug'. From what I've seen, this should be affecting most of us. But perhaps most content creators are using dual PC setups by now? Or maybe most people are tolerant to these periodic frame rate drops and still consider the footage smooth?

As for reaching out to Microsoft, I think it's more likely they'll just blame Nvidia for this issue instead, but I hope I'm wrong about this. :)
 

darthclide

Member
The common denominator of all who reported this exact problem was: Nvidia cards and single PC setup for gaming & streaming / recording.
But why do you think it isn't affecting those with dual PC setups? If this is some bad interaction between Windows and OBS/XSplit then it shouldn't matter how many computers you are using?

But perhaps most content creators are using dual PC setups by now? Or maybe most people are tolerant to these periodic frame rate drops and still consider the footage smooth?
I think most people that have successful streams have simply thrown their money (of which they have an abundance) at the problem until they figured it out. And for the streamers who have no money and no success, I am guessing they are mostly on average computers and can only output a 30fps stream. Ironically the only reason I know this problem exists is because my computer easily handles 720p 60fps on the NVENC encoder, and my GPU never goes above 60%, and I never drop frames due to encoder lag. If I were still on 30fps like I used to be, I wouldn't be able to see these stutters.
 

Ken Ishizu

New Member
But why do you think it isn't affecting those with dual PC setups? If this is some bad interaction between Windows and OBS/XSplit then it shouldn't matter how many computers you are using?
Dual PC setups use capture cards, so the problem is gone either because a DirectShow source to grab frames delivered by that hardware bypasses the DirectX 11 "bug", like I mentioned before. Or since no game is actually running in the second PC, DirectX or Windows DWM doesn't mess with the frame update priority of the OBS / XSplit process.
 

Ken Ishizu

New Member
I think most people that have successful streams have simply thrown their money (of which they have an abundance) at the problem until they figured it out. And for the streamers who have no money and no success, I am guessing they are mostly on average computers and can only output a 30fps stream.
The builds of people with this kind of problem varied a lot, judging by what was shared about their gaming rigs in other threads, ranging from low end PCs to high end ones. But yeah, I agree that there may be a combination of hardware that causes the stuttering. Just like you said, people with spare money to burn may be replacing hardware until they figure out a combo that doesn't have this issue.

When I get the chance, I'll try setting up a capture card, operating in passthrough mode with my current monitor, to test the theory about the DirectShow source bypassing the frame update issue. It's kinda sad to do this in a single PC setup, but it will be worth it if this solves the stuttering problem.

Also, I want to share this particular post made back in 2015 that explained some interesting details about the mechanisms behind video captures.
The discussion about the issue mostly happened on IRC, the forum often isn't an environment conductive to very technical discussions. (Not saying that the forum isn't suited to its purpose, it usually is.)

The main problem seems to be that when Microsoft took the step to using DirectX to render (mostly) everything Windows, they likely ran into some issues, such as Windows trying to update themselves too often, and thus it sometimes rationalizes and decides that just maybe a window's backbuffer doesn't need to be updated all the time. It can sometimes be observed directly in games running in windowed mode as well. (Any frame rate counter may display 60, while the game appears to be running at 30 or so.)

We tried things like force flushing the D3D buffer and reducing the number of backbuffers to ensure that all frames got displayed, but it seemed to go completely ignored by DirectX (10) itself. With obs-studio and DirectX 11, we managed to force it to render all frames, but that came at the cost of erratic frame rates for asynchronous sources such as capture cards and webcams.

The reasoning behind handling it like this was most likely that people were likely to play games in fullscreen, which isn't part of the DWM (Desktop Window Manager), and if they wanted to watch movies they'd have hardware overlay surfaces (which also bypass the DWM), and because of that it wouldn't be much of an issue. Sadly attempting to use their new technology results in some hurdles to overcome for less conventional software developers.

OpenGL also bypasses the DWM, and thus isn't susceptible to these things, but it's also the reason why OpenGL applications can't be captured using Window Capture.

One thing to keep in mind when using obs-studio in OpenGL mode; Display Capture cannot be used efficiently in Windows 8 or 10 in this mode, it's somewhat workable in Windows 7 with Aero disabled, but still a lot of extra CPU load. It's possible that some sort of texture sharing through the Desktop Duplicator API could be supported at some point, but I don't believe that it's a planned feature.

I tried changing some things in the OBS source code to compile and test some stuff in my PC, but since I'm not very knowledgeable about developing this type of software, I couldn't find any pattern / logic during my debugging attempts to explain why these duplicated frames kept happening periodically.

Even though the problem clearly lies outside OBS, I think it would be nice if we had some input about this matter from experienced developers. The ones who devoted their personal time learning and contributing to this wonderful project will likely know a lot about the intricacies and obscure details involving the Windows / DirectX API / DWM (Aero). Maybe we will be able to finally pinpoint the exact cause of this problem, and hopefully find a way to work around it / fix it. Or at the very least, we will be able to make an accurate report about this to Microsoft or Nvidia.
 

carlmmii

Active Member
Fwiw, I've been dealing with this problem on both streaming rigs. Both with capture cards (one internal magewell, the other usb magewell). Both have had various NVidia cards (780, 970, 1080, 2070), both have seen this issue through all windows 10 updates over the last 2 years. However, for me the stuttering is only shown in the preview -- it is not apparent in the recording or stream (although the playback in VLC or on twitch VOD comes with its own separate hiccup issues).

I've been keeping a keen eye on any sort of information that might be useful, but it's basically been the same story for years now, just as Ken said. Limited to win10 w/ NVidia, and only people who care/can see the preview issue will have anything to contribute, and everyone has a slightly different issue happening to them.

Apparent workarounds have been reverting to win7 (which is quickly not becoming an option), switching to an AMD card (which is definitely not an option for a lot of us), or running your monitor at 120hz (which has its own issues).
 
Last edited:

darthclide

Member
I think it would be nice if we had some input about this matter from experienced developers.
And that is why this issue will never be resolved. It would be one thing if a majority of top Twitch streamers were on here asking for assistance. But since it is mostly just average to no-name streamers, there is no rush to get this resolved. Another reason is that it isn't a simple fix. I have worked freelance development before, and everyone loves to work on the easy problems. It is very rare to find someone who works on the tough problems, and that is even while being paid. Imagine what the odds are for people not being paid...
 

darthclide

Member
When I get the chance, I'll try setting up a capture card, operating in passthrough mode with my current monitor, to test the theory about the DirectShow source bypassing the frame update issue. It's kinda sad to do this in a single PC setup, but it will be worth it if this solves the stuttering problem.
Have you got around to doing this testing yet? I know it sounds crazy, but I just bought 2 new cables for my monitors. I am unsure if my screen blacking out at random (sometimes it goes 1 week without a 1-2 second black screen) is related to this problem, but while I can't afford new monitors, I will definitely try cables that aren't 8 years old.
 
Last edited:

Ken Ishizu

New Member
Have you got around to doing this testing yet?
Yes! At first I was having some troubles with tearing even with V-Sync on, but that was solved after I forced my monitor to operate at 60 Hz with Custom Resolution Utility. I tested two different setups:
1) Passthrough - HDMI 2.0 cable from Graphics Card to Capture Card's Input and HDMI 2.0 cable from the Capture Card's Output to my 60 Hz monitor (HDMI 1.4 support).
2) Cloned Display - HDMI 2.0 cable from Graphics Card to Capture Card's Input and DP cable from Graphics Card to my 144 Hz monitor (DP support).

I know there's another setup involving a capture card and OBS Fullscreen Projection on the capture card "display", but that would once again rely on DirectX 11 Game Capture, so I thought it would be pointless to even attempt this particular setup.

After my testings, I found out that the first setup scenario gave me the best results, even though I was capped at HDMI 1.4. I could still see a few duplicated frames on GPU intensive scenes (I was recording Rise of the Tomb Raider in 1440p, on Very High preset), but they only lasted for 2 or 3 frames. That's a major improvement over the 30 - 45 seconds of stuttering every 10 to 15 minutes I was facing in Game / Window / Display Capture modes.

The second setup had some issues. First, I had to set the monitor's refresh rate at either 60 Hz or 120 Hz, to avoid the stuttering associated with 144 not being divisible by 60. Then, I noticed that Windows messed up with the resolution every time the main display, which was cloned to the capture card, went into full screen mode. I'm not sure how to describe it, but I had the impression the resolution got downscaled to 1080p from 1440p, then upscaled back to 1440p. In this 'glitchy' fullscreen mode, the 'edges' weren't as sharp and the mouse pointer speed increased considerably. So I tried playing the game at borderless windowed mode to avoid this cloned display resolution issue, but that reduced my in-game performance because the GPU was rendering everything handled by Windows DWM. The stuttering issue itself was gone, just like in the first scenario.

In conclusion, it seems the capture card did help in my case. The major difference I noticed between the two tests was in-game performance, the video quality looked the same to me. But since I've only recorded a few hours of footage, it may be too early to assume the stuttering issue is gone for good.
 

darthclide

Member
I could still see a few duplicated frames on GPU intensive scenes
I am assuming the encoder got overloaded during these moments? In 1 hour of game play, how many stutters did you see? The fact that you see any is very odd... Shouldn't they be gone completely if it is a directx capture issue? Doesn't these few stutters indicate something even more fundamentally wrong going on?

And obviously this is beside the point. Nobody should have to use a janky solution of gpu -> capture card -> monitor just to fix things. You are adding another piece of hardware that could fail on you, ruining this whole idea.

I was hoping you could find a way to force my GPU to use DirectShow, since I can't even afford a capture card.

Please continue testing with it, and really make sure it solved it. Only then can we start pushing the developers to do something. Isn't it interesting that not a single developer has responded here? Kind of like "if I pretend the problem doesn't exist it will go away"...
 

Ken Ishizu

New Member
I am assuming the encoder got overloaded during these moments? In 1 hour of game play, how many stutters did you see? The fact that you see any is very odd... Shouldn't they be gone completely if it is a directx capture issue? Doesn't these few stutters indicate something even more fundamentally wrong going on?
The number of microstutters varied a bit, but I think it was averaging 10 duplicated frames per hour of footage. Again, I didn't see any encoder / rendering lags or skips reported by OBS, so it seems to be an external factor once more. It may be related to the buffering of frames acquired from a capture card. Or it may be the capture's card timing when collecting frames that passes through it. I don't think there's a guaranteed way to fully avoid these types of problems.

Anyway, I think the quality of the video I recorded this way is 100% acceptable. I'll keep using this setup for now.
And obviously this is beside the point. Nobody should have to use a janky solution of gpu -> capture card -> monitor just to fix things. You are adding another piece of hardware that could fail on you, ruining this whole idea.
Agreed. Using a capture card in a single PC setup adds a lot of overhead and uses up extra resources when compared to DX11 Game Capture mode. I'd rather be using the Game Capture mode because it also supports neat options like not capturing the mouse cursor. :)

Isn't it interesting that not a single developer has responded here? Kind of like "if I pretend the problem doesn't exist it will go away"...
Well, it really seems like something impossible to fix by just tweaking the calls to the DX11 API or even Desktop Duplication API. When I attempted to fix the issue myself (at least in Display Capture), everything I tried just made things worse. It's similar to what was posted here:
We tried things like force flushing the D3D buffer and reducing the number of backbuffers to ensure that all frames got displayed, but it seemed to go completely ignored by DirectX (10) itself. With obs-studio and DirectX 11, we managed to force it to render all frames, but that came at the cost of erratic frame rates for asynchronous sources such as capture cards and webcams.
In the end, I think everyone just gave up trying to find a work around. Every attempt to force the frame updates resulted in other undesirable side effects. I have no idea why Windows stops updating the frames properly every 10 to 15 minutes. :(
It would still be nice to hear from the developers who tried to solve this obscure problem in the past. Their shared experiences may help us understand this issue better in order to either:
- Focus our attention in one "potential culprit" (drivers, Windows DWM, DirectX 11).
- Simply give up and accept that this is indeed something that can't be fixed on our end (hopefully this is not the case).
 

darthclide

Member
Anyway, I think the quality of the video I recorded this way is 100% acceptable.
But doesn't the game look off in color/performance? And isn't there some major input delay for your mouse?
Well, it really seems like something impossible to fix by just tweaking the calls to the DX11 API or even Desktop Duplication API
But you aren't the one who has spent hundreds of hours working with OBS code. It shouldn't be you who has to solve it.
We tried things like force flushing the D3D buffer and reducing the number of backbuffers to ensure that all frames got displayed, but it seemed to go completely ignored by DirectX (10) itself. With obs-studio and DirectX 11, we managed to force it to render all frames, but that came at the cost of erratic frame rates for asynchronous sources such as capture cards and webcams.
"We tried". Did it ever occur to any of them, even Jim, to just contact Microsoft to help solve it? I can't believe that OBS is so far beneath Microsoft that not 1 DirectX expert from Microsoft would be willing to help. And perhaps while in 2015 they didn't have any clout, I have to believe they could try again now, with more resources at their disposal.
 

Ken Ishizu

New Member
But doesn't the game look off in color/performance? And isn't there some major input delay for your mouse?
Good point! I forgot to mention that. The colors were fine, but I'm not 100% sure whether the passthrough introduced some minor input lag or not. I should try recording a competitive game later to confirm this.

But you aren't the one who has spent hundreds of hours working with OBS code. It shouldn't be you who has to solve it.
Well, this is an open source project so anyone should be able to fix. :)
But yeah, I agree with you. Since this issue is quite complex, it's not really a good idea to leave it in the hands of an amateur like me.

And perhaps while in 2015 they didn't have any clout, I have to believe they could try again now, with more resources at their disposal.
I think so too. A lot of things changed since then.
 

darthclide

Member
I should try recording a competitive game later to confirm this.
I wasn't even thinking about competitive games. I just remember playing console on big TVs and ever since then I don't like any delay greater than a few ms.


open source project so anyone should be able to fix
And as I mentioned before, difficult problems are swept under the rug around here sadly. I will continue adding any relevant information to this post every so often, but time will tell if any developers actually will help and not just blame our hardware or some "mysterious" 3rd party application running in the background.

On a tangent to that: for anyone else having this problem and are reading this, don't assume the support staff are 100% infallible when say it is a 3rd party application. My testing has ranged from a 2 year old partition of Windows, to a fresh 10 minute old install of Windows. And in all tests I have closed everything I possibly could without touching critical Windows processes.
 

darthclide

Member
Well. Windows 7 was a bust. Unless it is a problem with Professional, or that it is out of date with updates, the problem was still there. However, if I removed my 2 webcams, the long 30 second stutter issue would go away. It was replaced by microstutters every 30 seconds or so. And then sometimes a 5-10 second burst of stutter, but then back to 60fps solid.

So add that to the list of testing on a completely fresh install of Windows exhibiting this problem. Heck, I didn't even install my audio card drivers. It was barebones latest GPU driver, chipset driver, OBS install, and opening the game.

So this begs the question: If everyone else solved this issue with Windows 7, why isn't it working for me?

I know you probably tried it already, but do you have 2 completely different 60hz monitors you could try plugging in? Because the only similarities between my 2 computer towers is 1. The monitors 2. The GPU manufacturer 3. The motherboard manufacturer (ASUS/Intel) and 4. A UPS installed on each for brownouts.
 

Ken Ishizu

New Member
I tested two monitors. One of them is a native 60 Hz monitor, which has almost perfect 60 Hz (60.0001) refresh rate according to a V-Sync test site. This one always gave me the best results.

The other monitor has G-Sync support and operates at 144 Hz, but for testing purposes I disabled G-Sync and set the refresh rate to 60 Hz. However, the refresh rate was closer to 59.95 Hz (59.9537) according to the V-Sync tests and I could see some minor stuttering every minute.

The only way to solve this microstuttering issue was to use Custom Resolution Utility to force the refresh rate at "true" 60 Hz.

Also, I noticed that activating G-Sync or Freesync will introduce a lot of stutter throughout the entire recording. But I guess this is somewhat expected since no software supports the capture of variable frame rates that matches the variable refresh rates of G-Sync / Freesync, besides a very old version of Nvidia's Shadowplay (I'm not 100% sure about this one, though).
 

darthclide

Member
I tested two monitors.
Ah, so you haven't actually tested on 2 completely different monitors? I know it is a long shot, but I think it would be a good idea so that the developers here have one less thing they can blame it on.

The only way to solve this microstuttering issue was to use Custom Resolution Utility to force the refresh rate at "true" 60 Hz.
I assume this microstutter is completely unrelated to the problem in this thread? I ask because I forgot to mention in my Windows 7 testing, I had screen tearing in my game, even though I had vsync on. This has never happened in all my gaming on Windows 10. So yes, this could just be Windows 7 being flaky due to being old, or maybe part of our problem lies in Windows getting the wrong idea on what the refresh rate is? Which in turn screws with OBS the same way GSync monitors mess with OBS. (variable fps)

I guess I can ask this pointed question to anyone reading this thread: Has using a Custom Resolution Utility to force 60Hz, completely removed all stutters, micro or otherwise, from your preview?

*Edit* I haven't mentioned it in this thread yet, but there is a way to fix this stutter the moment it starts happening. Either swap your FPS output to something else and back. Or swap your color range from partial to full. Literally the moment I do either of these things, the stutter is 100% gone. (I am unsure if changing other settings related to the preview has the same affect). Yes, I know... This doesn't help us if we are livestreaming. We can't change ANY setting related to output once we start. However, for those of you recording locally, you could at least stop recording, swap these settings, and then record again. After all that, you could stitch your videos together.

The point is. There is a way to fix it temporarily, and it is precisely why I think you are onto something with DirectX rendering. How else could a 1 second swap of settings fix this issue immediately? it is almost as if you are telling Windows "hey, wake up, there is a preview you are supposed to be rendering".
 
Last edited:
Top