[FFmpeg-user] How to concat two videos with same size but different source?

Bo Berglund bo.berglund at gmail.com
Sat Oct 8 20:30:03 EEST 2022

On Sat, 08 Oct 2022 21:30:04 +0900, Masaru Nomiya <nomiya at galaxy.dti.ne.jp>

>BB>  When I do this using the common way with this command:
>BB>  ffmpeg -f concat -safe 0 -i join.txt -c copy joinedfile.mp4
>If the codecs are the same, you can do the following.
>First, create a text file with each line describing the files to be
>combined like this;
>file /path/to/fileA.mp4
>file /path/to/fileB.mp4
>Next, execute the following command in the same directory as this text
>  $ ffmpeg -f concat -i mylist.txt -c copy output.mp4

This is what I said I did (see above), the only difference is that I used the
 -safe 0 
too. This comes from looking up commands on the web, what does it do?

>If you want to combine videos with different codecs, either remove -c
>copy (the default codec is used) or specify the codec to encode.

I have now repeated my earlier test using the file to carry the list of videos:

ffmpeg -hide_banner -f concat -i join.txt output.mp4

This did not work at all. The first video part plays ok in the output but at the
switchover point to the second part the video playback stalls the image but
continues the audio behind the still of the last image of the first video.

What is the difference between the above approach and this:

ffmpeg -hide_banner -f concat -i video1.mp4 -i video2.mp4 output.mp4

And how can I get both videos (which play OK separately) concatenated properly?

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list