Skip to content

Instantly share code, notes, and snippets.

@Filarius
Created January 4, 2025 03:17
Show Gist options
  • Select an option

  • Save Filarius/c131432854b2174087a63144c9fbab74 to your computer and use it in GitHub Desktop.

Select an option

Save Filarius/c131432854b2174087a63144c9fbab74 to your computer and use it in GitHub Desktop.
ffmpeg video frame deduplicate
dedublicating frames from video
good explanation
https://kodintent.wordpress.com/2020/04/19/ffmpeg-mpdecimate-parameters/
ffmpeg mpdecimate filter
This will generate a console readout showing which frames the filter thinks are duplicates.
ffmpeg -i input.mp4 -vf mpdecimate -loglevel debug -f null -
To generate a video from a video source with audio with the duplicates removed
ffmpeg -i input.mp4 -vf mpdecimate -vsync vfr out.mp4
To generate a video from a video source without audio with the duplicates removed
ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4
-i 1.mkv -vf mpdecimate=max=3:hi=6400:lo=4000:frac=0.7 -vsync vfr
filter compare two frames by every 8x8 block
- if there at last one block have diff more than "hi" - it is not a dublicate
- "frac" is how many blocks above "lo" value is allowed. frac=1 - all blocks allowed to be higher than "lo" and only "hi" metter
max possible diff is 255*64 = 16320 ??
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment