Field notes · 2026-10-26
Remove idle duplicate frames from CCTV video with FFmpeg
Motion-activated CCTV exports often pad quiet periods by repeating the last frame, sometimes under a black overlay. How can mpdecimate drop those idle duplicates so only real action remains?
Answer
Answered by the Tracewind engineering team.
FFmpeg’s mpdecimate filter removes frames that are very similar to an earlier one, but it keeps a single representative from each duplicate run. That is why a long idle stretch still leaves one still image. Chain mpdecimate with setpts so the timeline stays continuous, for example: ffmpeg -i in.mp4 -vf "mpdecimate=hi=64*12:lo=64*8:frac=0.1,setpts=N/FRAME_RATE/TB" -an out.mp4, with FRAME_RATE set to the target rate (e.g. 25/1).
Raise hi and lo if idle stills remain; lower them if genuine motion is dropped. When a burned-in black “no motion” rectangle makes consecutive idle frames differ just enough to survive, crop that overlay away first so comparison uses only the picture area, then run mpdecimate. Always spot-check a short segment with ffplay before processing a full export.
Where this question came from
The question is paraphrased from a public post on video (2026-10); the person who asked it has no link to us. Read the original thread