[FFmpeg-user] Concatenate files

Valerio Pachera sirio81 at gmail.com
Fri Jul 30 18:56:24 EEST 2021

Hi all, I'm trying to concatenate 3 files recorded by OBS studio on a
kubuntu 20.04.
They all share the same settings/codec and container:
30fps, h264, aac (44.100Hz 32bit), 1920x1080, mkv

First of all I tried using this syntax:

ffmpeg -f concat -safe 0 -i mylist.txt -c copy big.mkv

I get the error

[concat @ 0x56177e1a9740] Line 1: unknown keyword 'file1.mkv'
mylist.txt: Invalid data found when processing input

mylist.txt has been create by kate with utf8 encoding.

1) So this is my first question: whats wrong with this syntax?
(In the man the keywork "concat" is not mentioned).

Googleing I found an alternative syntax:

ffmpeg -i "concat:file1.kvm|file2.mkv|file3.mkv" -safe 0 -c:a copy
-c:v copy big.mkv

With local path che be shortened by
ffmpeg -i "concat:$(ls *.mkv| tr '\n' '|')" -c:a copy -c:v copy big.mkv

It does work!
In a bit more than 1 second i concatenate 3 files of about 40MB.
The resulting big.mkv is smaller than the sum tough: 96MB...
Cheking it's lenght, it matches the lenght of file2.mkv :-(

2) do you have an idea of what could be wrong?

More information about the ffmpeg-user mailing list