[FFmpeg-user] Feature Request: Add 'min' option to 'mpdecimate' filter

Joan Lluch joan.lluch at icloud.com
Mon Apr 24 16:26:42 EEST 2023

This is a feature request for the mpdecimate filter,

I believe this is the appropriate mailing list, but in case it is not, please I would appreciate someone to redirect me to the right place. Thanks in advance


I would want to have a ‘min’ option added to the ‘mpdecimate’ filter.

‘min’ would specify a minimum number of identical (according to specified thresholds) frames that the filter must encounter before subsequent frames start to be dropped. 

As per the current behaviour, the mpdecimate filter always keeps at least 2 identical consecutive frames (instead of  just 1) , even if ‘max' is set to 0. I assume that’s a bug, as it’s not consistent with the description "Drop frames that do not differ greatly from the previous frame” which should imply keeping only the first frame, however that’s not the purpose of this request. Therefore, according with the current behaviour, that implies min=1, so this should be set as the default to prevent breaking current user cases.


The purpose is to prevent dropping frame sequences which are shorter than a specified ‘min’ amount.

For example  "-vf mpdecimate=min=30” would mean that any sequence of 30 or less identical frames will be preserved on the output file (not dropped) 

Use Case:

I want to apply the filter to my screen capture videos which have arbitrarily long pauses or delays in them.  

In screen captured videos, particularly educational ones showing the use of software or coding, inconsistent pauses are very common because people tend to spend time thinking before clicking the mouse or performing actions on the computer. Also the computer may be slow at completing some tasks, with prolonged periods of screen inactivity.

Currently, I use the following command to remove all pauses from such videos:

ffmpeg -i $INPUT -vf mpdecimate,setpts=N/FRAME_RATE/TB -an $OUTPUT

or this to reduce long pauses by a factor of 1/5:

ffmpeg -i $INPUT -vf mpdecimate=max=5,setpts=N/FRAME_RATE/TB -an $OUTPUT

However this is suboptimal and unnatural for my intended use case because, I would want to preserve all pauses shorter than a given time ( such as 1 second), but only trim or reduce the ones that are longer than that.

With the addition of the ‘min’ option, that would be possible, and I think that would also benefit a lot of users that asked for the same on the internet


John Lluch


More information about the ffmpeg-user mailing list