ffmpeg merge files into one

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

ffmpeg merge files into one

Post by cah »

16. Joining or merging multiple video parts into one
FFmpeg will also join the multiple video parts and create a single video file.

Create join.txt file that contains the exact paths of the files that you want to join. All files should be same format (same codec). The path name of all files should be mentioned one by one like below.

file /home/sk/myvideos/part1.mp4
file /home/sk/myvideos/part2.mp4
file /home/sk/myvideos/part3.mp4
file /home/sk/myvideos/part4.mp4
Now, join all files using command:

$ ffmpeg -f concat -i join.txt -c copy output.mp4
If you get an error something like below;

[concat @ 0x555fed174cc0] Unsafe file name '/path/to/mp4'
join.txt: Operation not permitted
Add “-safe 0”:

$ ffmpeg -f concat -safe 0 -i join.txt -c copy output.mp4
The above command will join part1.mp4, part2.mp4, part3.mp4, and part4.mp4 files into a single file called “output.mp4”.
CAH, The Great
Post Reply