How to concatenate / merge multiple video files | Concatenation Lesson Part 02

Published: 02 January 2023
on channel: The FFMPEG guy
701
28

Today, we show how to concatenate (.i.e. add one after the other) many (many) video files. Concatenation allows to merge / add both video and audio tracks / streams. All parameters can be customized to suit your needs.

IMPORTANT! All files to be concatenated need to be of the same type (same format, size, SAR, audio sample rate, ...) or the concatenation will fail or produce unpredictible results (video skipping frames, video and audio out of sync', ...)
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
EXAMPLE
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Concatenate many videos (image & sound)
→ ffmpeg -f concat -safe 0 -i filelist.txt -c copy output01.mp4

with:
* -f concat = Calls the concat «demuxer» …
* -i filelist.txt = … to read, in order, all the files listed in text file «filelist.txt» …
* -c copy = … and copies each input streams …
* output01.mp4 = … into the final video “output01.mp4”.
* -safe 0 = Avoids ffmpeg complaining about “unsafe” paths / filenames

❷ BONUS: Create the “filelist.txt” with 1 command (Windows)
→ (for %f in (*.mp4) do @echo file ‘%f') [greater than sign.. can't put in the description though since YouTube does not allow it) filelist.txt

with:
* (for %f in (*.mp4) = For every .mp4 files in the folder …
* do @echo file ‘%f') = … writes the line ‘filename.mp4’ …
* filelist.txt = … in text file “filelist.txt”
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
   • ALL THE VIDEOS FROM THE CHANNEL  
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Mover - DivKid
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ


Watch video How to concatenate / merge multiple video files | Concatenation Lesson Part 02 online without registration, duration hours minute second in high quality. This video was added by user The FFMPEG guy 02 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 701 once and liked it 28 people.