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

Masaru Nomiya nomiya at galaxy.dti.ne.jp
Sat Oct 8 15:30:04 EEST 2022


In the Message; 

  Subject    : [FFmpeg-user] How to concat two videos with same size but different source?
  Message-ID : <6ic2kht3vqn8u99bapvrbtauld14g61s12 at 4ax.com>
  Date & Time: Sat, 08 Oct 2022 10:31:06 +0200

[BB] == Bo Berglund <bo.berglund at gmail.com> has written:

BB>  I have two mp4 videos both at 480p resolution, which I want to concat.
BB>  They are together about 80 minutes long.

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

BB>  using a file specifying the video sections to concatenate the
BB>  result plays very poorly and has many artifacts.

BB>  And at the border between the two videos the output video becomes
BB>  unplayable.

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

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


┏━━┓彡    Masaru Nomiya               mail-to: nomiya @ galaxy.dti.ne.jp
┗━━┛  "A society bound by e-mail and mobile phones deprives us of the
	  freedom to face ourselves and indulge our fantasies."
                                       -- Michael Crichton (Speech in Japan) --

More information about the ffmpeg-user mailing list