Remove sequentially duplicate frames when using FFmpeg

后端 未结 2 1620
难免孤独
难免孤独 2020-11-27 12:31

Is there any way to detect duplicate frames within the video using ffmpeg?

I tried -vf flag with select=gt(scene\\,0.xxx) for

2条回答
  •  温柔的废话
    2020-11-27 13:16

    Use the mpdecimate filter, whose purpose is to "Drop frames that do not differ greatly from the previous frame in order to reduce frame rate."

    • 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 with the duplicates removed

      ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4
      

    The setpts filter expression generates smooth timestamps for a video at FRAME_RATE FPS. See an explanation for timestamps at What is video timescale, timebase, or timestamp in ffmpeg?

提交回复
热议问题