Field notes · 2026-11-15

Stop ffmpeg RAM growth on live transcode by dropping frames

When live camera footage is transcoded in real time and the machine cannot keep up, ffmpeg may buffer incoming frames until memory is exhausted. How can you make it drop frames instead and keep queues small?

Answer

Answered by the Tracewind engineering team.

If the encoder is slower than the live source, default behaviour is to queue packets. Memory then climbs until the process or the host fails. For live inputs you usually want low delay, small queues, and an explicit policy to drop late frames rather than wait forever.

A practical pattern is: -fflags nobuffer -flags low_delay -thread_queue_size 32 -probesize 32 -analyzeduration 0 on the input, and -fps_mode drop on current ffmpeg (or -vsync drop on older builds) on the output side. If a steady lower frame rate is acceptable, insert -vf fps=N so the encoder simply has less work. Confirm with -progress that speed stays near real time.

Also revisit the codec choice. Heavy CPU encodes (for example MPEG-2 at full camera rate) fall behind easily; a faster preset, a simpler codec, or hardware encoding reduces how often you must drop. These knobs are for live catch-up only—they do not repair already-recorded files that fail to open or play.

Where this question came from

The question is paraphrased from a public post on Super User (2026-11); the person who asked it has no link to us. Read the original thread

Stuck on something similar?

Send us a sample