I have a c# application where I have control of an ffmpeg (https://www.ffmpeg.org/) process. I am using it to capture video and audio, either from desktop or webcam. I am using code similar to the answer from this question (https://stackoverflow.com/questions/45206312/how-to-pause-resume-ffmpeg-video-capture-in-windows-from-c-sharp-application) to suspend and resume the process. However, while suspended, the captured video extends the frame it was suspended on for the entire duration of the suspension.
My arguments passed into the process:
-f gdigrab -framerate 30 -i desktop -f dshow -i audio="Stereo Mix (Realtek(R) Audio)" -preset ultrafast -pix_fmt rgb24 output.mp4
I have tried adding -vf setpts=N/FR/TB
to my arguments, and this works partially. It successfully prevents the extended frame, but then seriously affects the playback speed of the video.
How do I prevent this extended frame from occurring, or prevent the additional argument from affecting the playback speed of the video?
My ideal outcome is to have the process record, be suspended then resumed, and have the video play normally without having captured anything while suspended.
Record for 10 seconds, suspend for 20 seconds, record for 30 seconds, end recording -> should result in a 40 second video that plays back at normal speed.
I would love for a c# solution, but I believe the solution may be specific to the arguments I am passing in.