0

Hi I'm using ffmpeg to concatenate several mp4 files that I downloaded.

Usually they don't have the same encoding so I'm trying to encode them to have the same audio bitrate & resolution, the files output are converted correctly, but when I concatenate them they usually start having audio/video issues past the 1st video.

This are the following commands I'm using through the CLI to convert the inputs:

  ffmpeg -i 1.mp4 -b:v 1M -b:a 320k -aspect 16:9 -s 1600x900 1.ts
  ffmpeg -i 2.mp4 -b:v 1M -b:a 320k -aspect 16:9 -s 1600x900 2.ts
  ffmpeg -i 3.mp4 -b:v 1M -b:a 320k -aspect 16:9 -s 1600x900 3.ts

Then I put them in a list and run this command to concatenate them:

ffmpeg -f concat -i list.txt -codec copy output.mp4    

There are no output errors, but I'm still getting inconsistent results with the output (audio stutters, or video stops). I was originally trying to do it with fluent-ffmpeg but I have to find a correct way to do it through the CLI first.

Any help is greatly appreciated :)

Luis Doe
  • 1
  • 1

1 Answers1

0

If they don't all share the same encoding, you can't -codec copy them. You'll have to leave the codec off (and use the default encoding) or specify the encoding you want to use in the output. e.g.:

ffmpeg -f concat -i list.txt output.mp4
L. Scott Johnson
  • 4,213
  • 2
  • 17
  • 28