Question / Help On Unusual Duplicate Frames (Triplicate Frames)

AbeClancy

New Member
> Intro

Hello there, been having some weird experiences with OBS lately. I'll try my best to explain the issue and provide as much information as possible, but if I had to sum it up in one sentence, it would be: OBS is inconsistent about duplicating frames in a recording, sometimes even when it appears that it shouldn't be duplicating frames at all.

I've been running experiments with recording The Binding of Isaac Rebirth/Afterbirth. Everything seems to go fine, recording 1920x1080, 60 fps, <60% CPU usage overall (game EXE plus OBS EXE), GPU not even close (NVidia 980), using the software OBS-MP x264 encoder. Game runs without issue, recording seems more than adequately fast enough. Sometimes however, frames are duplicated. Now if a single frame is duplicated, even if it happens occasionally, I can understand that, nothing is perfect. But the ways in which the frames are duplicated do not make any sense to me. I have three general "cases" in which frames are duplicated.

I will note here, that in all these cases, the game itself performs flawlessly. I never can see any stutter or frame skipping in the game window. When "Case One" occurs, I can very easily see the stutter in the OBS preview window. When "Case Two/Three" occurs, I can vaguely catch the duplicated frames in the OBS preview window, but it is nowhere near as obvious as "Case One".

System has 16GB memory, quad-core that never exceeds 60% overall usage (usage is split between cores), NVidia 980, writing to RAID capable of 200 MB/s. Recording used to be fine, and sometimes still is, this seems to be a subtle issue. Oh, and I'm only locally recording, not streaming. (And, I was experiencing this with MP 12.0 as well as 13.0, but it only started within the past week.)

> Case One: Triplicated Frames

I first noticed this problem as severe stutters in the recording (and preview) from OBS. The game would play perfectly, the encoding seemed fast enough, nothing on the system would seem to be anywhere close to being maxed, but several times per second of recording, a frame would be duplicated not once, but twice. You can see what I mean in the below Dropbox image link.

https://www.dropbox.com/s/4zcr05bwgo93d9u/triplicate-explained.png?dl=0
https://www.dropbox.com/s/u5k3wtmc2lldp9c/triplicate-log-3.txt?dl=0

(Note: The log file showcases a recording that shows this issue. It is using the default Indistinquishable Quality setting, FLV container, and x264 standard (not the low-CPU usage) preset.)

The frames that are labeled "5" are included in the recording three times. The immediate frames before and after are fine, but for some reason occasionally (multiple times a second) a frame will be duplicated and appear three times in the output. The log never reported any duplicated frames, as if the encoder had no problems encoding the frame but was instead presented with a duplicated frame to encode. The game itself did not duplicate the frame, while testing the game window worked flawlessly without any stutter, only the OBS preview window/recording showed stutter and triplicated frames. None of this made much sense to me, as a duplicated frame on a non-stressed system should appear only one extra time in the output. For it to appear three times, I begun to think that there was a glitch at play.

I fiddled with settings, updated drivers and OBS, and rebooted my computer several times to resolve this issue. Nothing seemed to work... until it did. For some reason it all started working again without triplicated duplicated frames. And then after restarting OBS, the issue appeared once again.

> Case Two: Standard Duplicate Frame

After many restarts (system and OBS), I managed to get OBS to properly record the game without triplicating frames. In the next Dropbox image like, you will see a standard duplicated frame. This is what I expect of a duplicated frame (frame label 4 in this example). A frame is duplicated once (for whatever reason) and the recording continues. Frame label 5 does not exist because for some reason or another, it was not captured by OBS's encoder.

https://www.dropbox.com/s/uy90g6qz70titij/duplicate-expected-explained.png?dl=0
https://www.dropbox.com/s/8ng7l7w7abily7z/duplicate-log-2.txt?dl=0

> Case Three: Inverted Duplicate Frame

This is a bit of the inverse of the previous duplicate frame, in that a frame is duplicated and appears twice in the recording, but the missing frame isn't the subsequent frame, it's the one AFTER the next frame. This is actually the exact same recording as the previous "Case Two" example, but as you can see the missing frame is the wrong frame!

https://www.dropbox.com/s/90cxf4pn83joo0m/duplicate-unexpected-explained.png?dl=0

In the above image, frame label 4 is duplicated in the output, but the missing frame is not what you would expect. Frame label 5 is actually included in the output, it is frame label 6 that is missing, skipping straight to frame 7.

> Questions

My questions: What is going on here? Why is OBS occasionally giving me poor performance and triplicating frames multiple times per second, even though the system has more capacity than is being used by the encoder? Why are these duplicated frames not being logged in the log file? Why sometimes when I restart OBS does it boot-up in a "non-triplicating" mode and seems to give me normal performance? Why does OBS sometimes boot-up in glitchy-triplicating-frame-mode in the first place? Could the issue not be with the encoder (which never reports triplicated frames in the log output), but instead with whatever mechanism is being used to grab the frames from the framebuffer? How are frames grabbed in the first place? Does it wait for a swapped framebuffer, or just grab a frame from the buffer every 1/60th of a second? Could the timing of this be glitchy in some circumstances?

> Addendum

I will respond to any inquiries or replies regarding this as I can. And I apologize if this seems like your run-of-the-mill "wtf dropped frames how get better stream" thread, but I wouldn't trouble the forums if I thought that was the case. The occasional dropped frames in a recording will happen. And I've done this type of recording in the past without issues. This triplicate-frame duplication issue is new, and the inverted-duplicate-frame duplication makes me suspect an issue with obtaining the raw frame data, not necessarily with the encoding process that acts upon the frames.

Any suggestions would be appreciated!
 
Top