Monday, September 7, 2020

Removing "Still" Frames from Video Files with Ffmpeg

 Ffmpeg is a very versatile tool for video pre-processing and post-processing. One of its most useful feature is removing frames which doesn't have a lot of changes in it, i.e. relatively static background. The parameter to use for this purposes is the mpdecimate flag, the presentation timeframe (setpts)flag might also be used for synchronization purposes. In my case, the command I used to throwaway the relatively static vidio frames as follows:

ffmpeg -i input_vid.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB output_vid.mp4

Details about the mpdecimate flag can be read over at: https://ffmpeg.org/ffmpeg-filters.html#decimate-1, and details about the setpts parameter is at https://ffmpeg.org/ffmpeg-filters.html#toc-setpts_002c-asetpts. Hopefully, this is helpful for you.


Post a Comment

No comments: