How to concatenate / merge video files | Concatenation Lesson Part 01

Опубликовано: 20 Сентябрь 2022
на канале: The FFMPEG guy
1,013
27

Today, we show how to concatenate (.i.e. add one after the other) 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', ...)
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
EXAMPLES
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
❶ Concatenate 2 full videos (images & sound)
→ ffmpeg -i input01.mp4 -i input02.mp4 -filter_complex concat=n=2:v=1:a=1 output01.mp4

with:
-i input.mp4 = Imports file «input01.mp4» …
-i input02.mp4 = … and file «input02.mp4» …
-filter_complex concat = … and calls the “concat” (complex) filter function …
n=2 = … asking to concatenate 2 segments (input files), …
v=1 = … considering 1 video stream …
a=1 = … and 1 audio stream.
output01.mp4 = Outputs finally the result to file «output01.mp4»

❷ Concatenate 3 video parts (images & sound)
→ ffmpeg -ss 00:00:00.0 -to 00:00:04.5 -i input01.mp4 -ss 00:00:04 -to 00:00:08.5 -i input02.mp4 -ss 00:00:03.5 -to 00:00:04.5 -i input01.mp4 -filter_complex concat=n=3:v=1:a=1 output02.mp4

with:
-ss 00:00:00.0 -to 00:00:04.5 -i input01.mp4 = Reads file «input01.mp4» between seconds 0 & 4.5, …
-ss 00:00:04 -to 00:00:08.5 -i input02.mp4 = … reads file «input02.mp4» between seconds 4 & 8.5, …
-ss 00:00:03.5 -to 00:00:04.5 -i input01.mp4 = … and reads file «input01.mp4» between seconds 3.5 & 4.5. …
-filter_complex concat = … and calls the “concat” (complex) filter function …
n=3 = … asking to concatenate 3 segments (input files), …
v=1:a=1 = … considering 1 (v)ideo & 1 (a)udio streams …
output02.mp4 = … and outputs finally the result to file «output02.mp4»

❸ Concatenate 2 videos (sound only)
→ ffmpeg -ss 00:00:00.0 -to 00:00:05.0 -i input01.mp4 -ss 00:00:00 -to 00:00:05 -i input02.mp4 -filter_complex concat=n=2:v=0:a=1 output03.mp4

with:
-ss 00:00:00.0 -to 00:00:05.0 -i input01.mp4 = Reads file «input01.mp4» between seconds 0 & 5, …
-ss 00:00:00 -to 00:00:05 -i input02.mp4 = … and reads file «input02.mp4» between seconds 0 & 5, …
-filter_complex concat = … and calls the “concat” (complex) filter function …
n=2 = … asking to concatenate 2 segments (input files), …
v=0 = … considering 0 video stream (this means the video stream will not be concatenated to the original)…
a=1 = … and 1 audio stream.
output03.mp4 = Outputs finally the result to file «output03.mp4»
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
   • ALL THE VIDEOS FROM THE CHANNEL  
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Glacier - Chris Haugen
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ


Смотрите видео How to concatenate / merge video files | Concatenation Lesson Part 01 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь The FFMPEG guy 20 Сентябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,013 раз и оно понравилось 27 людям.