ScreenRecorderLib
ScreenRecorderLib copied to clipboard
Capture duration incorrect for fragmented recording when CPU is high
Hi,
This is a very useful library. Thanks to all who contributed.
While testing, I did find a weird issue when the fragmented recording option is turned on.
Basically if for any reason the capture loop is not at the specified framerate, the total duration will drift shorter resulting in sync issues.
One way to reproduce is to start the capture and then ran a CPU stress tool and capture exactly 5 mins of the desktop. You will see that the result video duration, when opened in the VLC, will say exactly 5 min, but when dragged to chrome web browser it will say something like 4:45 so about 15s short.
This behavior does not appear if the fragmented option is off.
I dumped the frames of the video and confirmed that the duration is indeed short.
I looked at the code and it looks like it is just using the MFCreateFMPEG4MediaSink instead of MFCreateMPEG4MediaSink so I have no clue how the behavior is different.
Can anyone share some insight on how to approach debugging this issue?
It only happens when you stress the cpu? Do you use gpu or cpu encoding?
I have only tested stressing the CPU because that's the most common scenario. It is using GPU accelerated encoding.
@sskodje Hi, just wondering if you were able to reproduce this issue.
Unfortunately i have not had any time to investigate it, as i've spent the time i have trying to get the next release out. Can you check if the issue is still present in this version?
https://github.com/sskodje/ScreenRecorderLib/actions/runs/1478803218