1

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|
1

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.

  • Thanks to your input I have found this question on Stackoverflow which explains how to use it. Unfortunately using the command ffmpeg -i in.mkv -vf mpdecimate out.mkv reduces the file size considerably but does not cut away the duplicated frames: the video length remains the same. – Marco Lackovic Oct 6 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.