<p>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.</p>
<p>Set a sane output framerate for such scenarios.</p>
<p><code>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</code></p>

CC BY-SA 4.0
2020-10-10T02:26:16.667Z
Yep,.... that did the trick, thanks!
wpkzz
CC BY-SA 4.0
2020-10-09T17:07:26.340Z
2020-10-09T17:07:26.340Z
Gyan
<p>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:</p>
<pre><code>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
</code></pre>
<p>So I took the first two clips, the first one mkv and the second one mp4 and I did:</p>
<pre><code>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
</code></pre>
<p>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.</p>
<p>What went wrong? What is the proper way to do this?</p>

<ffmpeg><editing><encoding><command-line>
I used ffmpeg to concatenate to videos and it got stuck and produced a huge file. Where is the mistake?
wpkzz
# I used ffmpeg to concatenate to videos and it got stuck and produced a huge file. Where is the mistake?

(Asked by: username_0 on 2020-10-09)

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?

**Tags:** ffmpeg, editing, encoding, command-line


---

## 1 answers

### Answer by username_1 on 2020-10-09. Score: 3 | Accepted answer

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`

> **Comments:**
> **username_0**: Yep,.... that did the trick, thanks!  

---

