[FFmpeg-user] How to drop frames to limit memory usage (or keep latency low)?

Victor Carneiro Fardim victorcarneiro at protonmail.com
Wed Apr 4 16:17:17 EEST 2018


Hi, Adam.

I don't see any way to do automatic frame skipping in FFmpeg.

What you could do is reduce the output framerate by using the `-r (framerate)` or the `fps` video filter, which will reduce the encoding load on the CPU.

Adjust this until the average encoding throughput is 1.00x (that means, when the average number of frames encoded per second is equal to the specified framerate, and your average CPU load is below ~90% just to be safe).

Also, I'm sure `mpeg2video` does not support encoding presets. If you want fast encoding, you may want to try `libx264` with `-preset ultrafast`, `-tune stillimage` and `-deblock 0:0`, since that can be faster than MPEG-2 depending on your CPU architecture, and maybe more efficient.

If available on your platform, you may also want to try hardware-accelerated H 264 encoding APIs. You can find some info here: https://trac.ffmpeg.org/wiki/HWAccelIntro (note: you may have to compile a custom build of FFmpeg to enable this feature, as pre-built ones aren't usually compiled for it.

Victor Carneiro


More information about the ffmpeg-user mailing list