here is my question that related to the same problem:
better way to record desktop via ffmpeg
I have this command : ffmpeg -f dshow -i video="screen-capture-recorder" -r 30 -t 10 E:\test01.flv
And i am happy with it, but i wonder if i can make it save every 30 minutes so if the power went off i only loses the last 30 minutes.
I use C#
to launch and hide ffmpeg cmd
, so i wonder how to make it save to the same test01.flv
every 30 minutes?
or
In C# check if the process is still running, if it doesn't then start it again so it starts recording for the next 30 minutes. This depends on how you are starting the child process so I cannot provide any code.
One method is to use the segment muxer:
From the docs:
This will result in output files named:
out001.flv
,out002.flv
,out003.flv
, etc.One problem is that if the command is re-invoked it will attempt to use the same output file names.
I removed
-r 30
from your command and changed it to-framerate 30
as a dshow input device option. Otherwise, since the default input frame rate is 25,ffmpeg
will duplicate frames to reach your desired output frame rate of 30. If you only provide an input frame rate, then the output will use the same frame rate and avoid dropping or duplicating frames to compensate.