Concatenating Two Videos and Two Audios - 2020
We're going to use a video, "San Francisco (Be Sure to Wear Flowers in Your Hair)" by Scott McKenzie (BeSureToWear.mp4) as a sample.
To make it more simple, we're going to merge (concatenate) the same video one after another.
The command looks like this:
ffmpeg -i BeSureToWear.mp4 -i BeSureToWear.mp4 -filter_complex '[0:v] [0:a:0] [1:v] [1:a:0] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' BeSureToWearConcat.mp4
From the command output below, we can check how ffmpeg does follow the command:
Stream mapping: Stream #0:0 (h264) -> concat:in0:v0 Stream #0:1 (aac) -> concat:in0:a0 Stream #1:0 (h264) -> concat:in1:v0 Stream #1:1 (aac) -> concat:in1:a0 concat:out:v0 -> Stream #0:0 (libx264) concat:out:a0 -> Stream #0:1 (libfdk_aac)
The concatenated output: BeSureToWearConcat.mp4
IN this section, we'll concatenate two audio files following the guide from How to concatenate(join, merge) media files . We'll concatenate the same two audio files from the same audio file: BeSureToWearFlowersInYourHair.mp3.
The command looks like this:
ffmpeg -f concat -i mylist.txt -c copy Two_BeSureToWearFlowersInYourHair.mp3
mylist.txt:
file ./BeSureToWearFlowersInYourHair.mp3 file ./BeSureToWearFlowersInYourHair.mp3
Output file: Two_BeSureToWearFlowersInYourHair.mp3.
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization