Bug Report Game capture frames "de-syncs" after ~30 minutes

Lapppy

Member
The game capture source captures a buttery smooth and perfect 60fps up until approximately 30 to 40 minutes into the recording, at that time the output appears to drop a couple of frames every few seconds, and then it ramps up and appears to be very stuttery with many duplicated frames, and then it slowly calms down over time. This whole event lasts for about 20-30 seconds, after which the recording is perfectly smooth 60fps until the next time interval rolls around.

It appears as if the game capture source appears to "de-sync" from grabbing frames at the right time.

This has been observed on two different computers, one of which is a laptop with very different hardware. The only thing that these computers really have in common is that they both are running Windows 10 and both have NVIDIA Graphics cards. This has also been observed with two different screens, both of which are 60Hz.

In attempts to solve this issue on my own with my own knowledge of OBS and by doing my own experimentation and research on these forums, I can safely assure that this problem is not caused by:
  • The encoder being overloaded, due to lack of CPU/GPU resources available to encode the output.
  • OBS having trouble rendering the canvas, as little/no frames are dropped due to lag stalls.
  • The Windows 10 Creators Update, The laptop has had this problem for the past two years, and the new desktop has had the problem since it was built.
  • Antivirus software. Avast has been known to cause issues with OBS recently and I do not have it installed on any computer. Both computers are only running Windows Defender at the moment.

In the past, I have encountered issues with how OBS handles refresh rates. In order for OBS to have a reasonably smooth output, the refresh rate of your monitor must match the framerate in OBS. Any deviation from this will cause stutters after some time. For my laptop, I had to set the framerate in OBS to be 60.017 fps to match the refresh rate of the screen and this reduced the stuttering from 1 minute intervals to 40 minute intervals. Recently I have built a new PC, and I purchased a new 60hz monitor. However this new PC also has this de-sync problem almost every 40 minutes like my laptop does.

---

Attached below is a log file from a session that reproduced this problem. I know that it is a few weeks old, however it clearly shows that the problem is not necessarily related to encoding/rendering lag. I've been looking at all my logs after every session, and while sometimes they do report dropped frames, there aren't enough dropped frames that would cause an issue. Sometimes it takes 100ms+ to download a frame, but I assume that is usually caused by alt-tabbing. The log file I provided best shows that the problem might not be performance related.

The problem still occurs in the latest version of OBS (19.0.2 as of this writing). Also as it is repeated many times on this forum (and I keep an eye on the github repo), there were no changes to the game capture source in the latest version, so upgrading wouldn't have made a difference anyways.

Take note of the following lines:

Code:
02:46:29.306: Output 'adv_file_output': stopping
02:46:29.306: Output 'adv_file_output': Total encoded frames: 371198
02:46:29.306: Output 'adv_file_output': Total drawn frames: 371201
02:46:29.306: ==== Recording Stop ================================================
Zero dropped frames were reported, yet the output file from this session did in fact have dropped frames after around 40 minutes.

Code:
03:06:12.982:    ┃ ┣download_frame: min=0 ms, median=0.066 ms, max=3.071 ms, 99th percentile=0.16 ms
The longest it took for a frame to get "downloaded" from the GPU during the session was 3.071 ms, which is definitely under the required 16.666 ms for 60fps.

In a recent attempt to determine the cause of the issue, I placed a 60fps gif image source in OBS that loops while recording. Frame by frame analysis shows that during the bug, the frame drops appear to only happen with the game capture source and not any other moving sources (such as a media source/image source). This has led me to believe that there is a underlying issue with how game capture captures frames and that the problem is not user error, though I would like to be wrong.

I've also monitored CPU and GPU stats during recording. There are no indications of increased cpu/gpu activity during the bug through task manager, procexp, nvidia inspctor, GPUZ, CPUZ, etc. Temperatures are normal, and not overheating.

---

A number of attempts have been made to solve the problem, all of which have been unsuccessful.
  • Set the OBS frame rate as the same as my monitors refresh rate. While this has improved stuttering issues in general, this has not solved this particular one which has happened with two different monitors.
  • Using VSYNC in games has helped tremendously with stutters, I highly recommend using it. However, this problem still persists.
  • Setting OBS to run at a "high priority" which may allow for more time to let OBS render the canvas, etc did not work.
  • Making sure that there is only one capture source in one scene, and nothing else.
  • Using a different encoder, such as x264 or QuickSync. Remember that the encoder is not the issue.
  • Attempting to use a different capture source. Display capture works for fullscreen games in Windows 10, however the capture performance is very poor at 60fps.
  • Toggling the "Limit capture framerate" option in the game capture settings, to force the game capture to capture at no more than OBS frame rate.
  • Disabling "Capture third party overlays" did not have any effect.
  • Overclocking the video card memory clock to make up for the 200mhz automatic downclock when using NVENC.
  • Enabling/disabling Game Mode and Fullscreen optimizations found in the Windows 10 Creators Update.
So, is it a bug, or is it a problem on my end?

One thing to note is that this is a very similar issue to one I had a few years ago, except it was with display capture. At that time is was determined that the problem was not going to be fixed, and that it is caused by how Windows renders the screen ... or something.

https://obsproject.com/forum/thread...ers-every-10-minutes.39269/reply?quote=181216

Does this also apply with how Game Capture grabs its frames? Or is it a separate method/issue?

Also, while taking a look at profiler data I see some interesting info in the logs.

Code:
03:06:12.982:  ┣tick_sources: min=0.001 ms, median=0.016 ms, max=113.491 ms, 99th percentile=0.03 ms
03:06:12.982:  ┣render_displays: min=0 ms, median=0.001 ms, max=29.55 ms, 99th percentile=0.003 ms
It took at most 113 ms to "tick sources" and at most 29 ms to "render displays". Supposedly this has to do with how OBS renders the canvas, etc but remember that the log reports no dropped frames due to rendering lag. I assume that these frames might have been lagged when the program is not recording?

Thank you all for your input.
 

Attachments

Lapppy

Member
While doing frame by frame analysis with a recent test, I came across some frames in the output which appear to have very distinct visual tearing when the problem occurs. Image has had usernames removed for... reasons.

 

Attachments

BK-Morpheus

Active Member
seems like i have the same problem. Butter smooth 60fps recording, but not for long. In Rocket league it can take up to 30minutes until the stutter occurs. After a few minutes it usually goes back to smooth footage for a while, before this repeats.
FPS capped to 60 (no matter if ingame with Vsync or with 3rd party tools like RTSS) and monitors configured to exactly 60Hz via Custom Resolution Utility.

CPU and GPU are not stalling/lagging frames (far from ~60% load on both) and this also happens with a completely new scene collection in OBS and it has since years (fresh windows installs including).
This has been the case on my old intel i7 rig, as well as on my newer Ryzen 7 rig.

Even the difference between output and drawn frames is not big, although the last 2-3minutes of the recording were clearly stuttering (in preview and recording).
00:42:14.472: [ffmpeg muxer: 'adv_file_output'] Output of file 'D:/Afterburner Captures/OBS 2018-10-12 00-09-14.mp4' stopped
00:42:14.472: Output 'adv_file_output': stopping
00:42:14.472: Output 'adv_file_output': Total frames output: 118716
00:42:14.472: Output 'adv_file_output': Total drawn frames: 118781
 

Ryfek

New Member
Record your videos in 120 fps if you can. I've tried looking for help in this thread couple monts ago having a similar problem:
https://obsproject.com/forum/thread...ifferent-systems-for-over-2-years-now.104252/
But after months and no help the stuttering/duplicated frames still occur. The only way for me to eliminate this problem is to stream and record in 120fps. Frames are still sometimes duplicated, but 120fps makes for a smooth playback anyway. This means that my videos take 2 times more space with a CQP and my stream set to constant bitrate looks 2 times worse, but it's at least smooth. I'm seriously out of ideas, I've tried every possible option in OBS on 2 of my PCs and I still can't get perfectly smooth 60fps capture with my videocard.
 

Harold

Active Member
Increasing the FPS is going to make things worse, not better if you're overloading your system.
 

Ryfek

New Member
Yeah, you'te the one that did not help and couldn't read carefully. As I said since changing to 120fps makes videos smooth and they've been smooth for the past 4 months. We're not overloading our systems, it's OBSs fault. Maybe when recording with a CPU this could be a problem, but even an older GPU like 1070 should not break a sweat with 4k 120fps 50BM/s recording. And it's not.
 

Ryfek

New Member
I record and stream my videos to YouTube in 120fps and it works great. YouTube re-encodes the videos well and never picks the duplicated frames, but yeah, recording in 60fps for good 60fps playback on all platforms would be nice after years of bugs.
 

xcasxcursex

New Member
Recording at a higher framerate only hides the problem, it still exists.

In my case it was ReShade, but any injector could do it so perhaps
Image has had usernames removed for... reasons.
It's the thing making your overlay.

 
Top