0

I have this short videoclips that i recorded either with my webcam or with my phone. The ones that come from my webcam are in Matroska container, and the ones from the phone in mp4. Each piece is between 50 and 150 MB in data size, some 3 or 5 minutes long. I read that the proper way to concatenate in ffmpeg was something of this sort:

ffmpeg -i input1.mp4 -i input2.webm -i input3.mov \
-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[outv][outa]"
 \-map "[outv]" -map "[outa]" output.mkv

So I took the first two clips, the first one mkv and the second one mp4 and I did:

ffmpeg -i intro.mkv -i part2.mp4 \
-filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" \
-map "[outv]" -map "[outa]" output.mp4

and it began to take time... and more time... and more time. After one hour I got worried and I checked the output.mp4 file and it was half a GB in size. Then after another hour it was 1.5 GB. And the process continued to run, in the terminal indicating huge numbers of framedrops. I terminated the process and tried to diagnose the output file but couldn't.

What went wrong? What is the proper way to do this?

2

The concat filter uses the frame rate of the first input as the framerate for the output stream. Some MKV/WebM files don't write valid framerates. That can lead ffmpeg to assign a framerate of 1000 (the inverse of default timebase in Matroska), which can lead to huge frame duplication.

Set a sane output framerate for such scenarios.

ffmpeg -i intro.mkv -i part2.mp4 \ -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]" \ -map "[outv]" -map "[outa]" -r 30 output.mp4

1
  • Yep,.... that did the trick, thanks!
    – wpkzz
    Oct 10 '20 at 2:26

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.