[FFmpeg-user] How to dynamically drop frames as required to keep transcoding real time?

Mark Filipak (ffmpeg) markfilipak at bog.us
Wed Apr 7 16:40:28 EEST 2021


On 2021-04-05 21:02, Adrian Cable wrote:
> Hi,
> I have a question that I thought should have an ‘easy’ answer – I have spent a lot of time searching and I cannot find it, so thought I would ask here.
> 
> My application sounds simple. I have an input RTSP stream, which I need to transcode and output as an RTP stream. Command line is very simple, something like:
> 
> ./ffmpeg -i rtsp://… -vf scale=1024:-1 -c:v libx264 -f rtp rtp://…
> 
> Now, ffmpeg is running on a CPU-constrained platform, and it may be that, in order for the transcoding to ‘keep up’ with the input, the output framerate needs to be less than the input framerate, which is totally fine. The problem/question is: how do I get ffmpeg to drop frames as required to keep the pipeline running real time?
> 
> I can’t simply ‘guess’ a sustainable output framerate and set using -r XXX or -vf fps=fps=XXX, because the properties of the input can change at any time, so any XXX won’t be constant.

XXX *will* be constant and independent of the input frame rate.
"Convert the video to specified constant frame rate by duplicating or dropping frames as necessary."

I hope this helps,
Mark.


More information about the ffmpeg-user mailing list