Remove frozen parts from a corrupted video When dealing with corrupted videos, ffmpeg is a great to tool to automatically fix errors.

Is there a way, with ffmpeg or another similar tool, to automatically remove/drop/trim/cut away frozen parts from a file, both video and audio streams?

Using a combination of mpdecimate and map it's possible to obtain the video stream only with:

ffmpeg -i input.ext -vf mpdecimate -map 0:v output.mp4


How to do the same thing with all streams of the file, audio and video?

Given a video with two streams like:

     0       1         2       3         4
video|AAAAAAA|FFFFFFFFF|BBBBBBB|FFFFFFFFF|
audio|XXXXXXX|YYYYYYYYY|ZZZZZZZ|KKKKKKKKK|


where A and B are the good parts to mantain and F are the frozen parts to be trimmed away, I want obtain a "cleaned" video (with the frozen parts and its associated audio removed) which in the end would look like:

0       1       2
video|AAAAAAA|BBBBBBB|
audio|XXXXXXX|ZZZZZZZ|
If your video has fixed frame rate, you probably mean by “frozen part” the part with the same frame repeated many times.

To remove duplicate frames you may apply the mpdecimate filter.