[FFmpeg-user] How to dynamically drop frames as required to keep transcoding real time?
adrian.cable at gmail.com
Wed Apr 7 17:10:06 EEST 2021
Mark – sorry if I wasn’t clear in my original email. The problem I am describing is real, not theoretical. I have enormous respect for the time of everyone on this list, and would not have emailed if my problem could be solved with “-vsync cfr” or anything as straightforward and as well documented.
XXX *will not* be constant and *will not* be independent of the input frame rate. This is unfortunately the problem I am trying to solve.
XXX will not be constant because the CPU load on the device (due to other running processes) varies over time. If other processes are loading the CPU, there will be less CPU available for encoding, so XXX will be lower. If the CPU load on the device (due to other running processes) is low, XXX will be higher. And, because CPU load (due to other running processes) may change during the transcode, XXX will vary during the transcode.
XXX will not be independent of the input frame rate, because decoding the input frames consumes CPU and memory bandwidth, which leaves less available for the re-encoding part. If the input frame rate is 60 fps, for example, XXX will be lower than if the input frame rate were 5 fps.
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> on behalf of Mark Filipak (ffmpeg) <markfilipak at bog.us>
Date: Wednesday, April 7, 2021 at 6:43 AM
To: ffmpeg-user at ffmpeg.org <ffmpeg-user at ffmpeg.org>
Subject: Re: [FFmpeg-user] How to dynamically drop frames as required to keep transcoding real time?
On 2021-04-05 21:02, Adrian Cable wrote:
> 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,
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user