I used ffmpeg to concatenate to videos and it got stuck and produced a huge file. Where is the mistake? 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 &quot;[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]&quot;
 \-map &quot;[outv]&quot; -map &quot;[outa]&quot; 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 &quot;[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]&quot; \
-map &quot;[outv]&quot; -map &quot;[outa]&quot; 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?
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 &quot;[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1[outv][outa]&quot; \ -map &quot;[outv]&quot; -map &quot;[outa]&quot; -r 30 output.mp4