video – ffmpeg: Drop both frames of a duplicate pair

I have a video with frequent duplicate frames. The video is 29.97 fps and it appears that about 1/6 of the frames are actually duplicates. The timing of the duplicated frames is not entirely consistent, so simply removing every nth frame is not possible.

I know I can use mpdecimate together with vfr to drop the second occurrence of the duplicated frame like so:

ffmpeg -i input.mp4 -vf mpdecimate -vsync vfr output.mp4

However, in my case I want to drop both frames of the duplicate pair. Say my frames are:

A-B-C-D-D-E

with D being the duplicated frame. mpdecimate turns this into

A-B-C-D---E

But for this specific case I want

A-B-C-----E

Is there a way to get this output with ffmpeg?

Read more here: Source link