Merge mp4 Files in Linux

Merge mp4 Files in Linux

One of the best ways to prevent losing quality from concatenating files is to transcode them to mpeg transport streams, using  H.264 video and AAC audio -

$ ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new1.ts

$ ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts new2.ts


$ ffmpeg -i "concat:new1.ts|new2.ts" -c copy -bsf:a aac_adtstoasc output.mp4

- In this example I use only 2 mp4 files converted to streams and then concatenating them, but you can
put as much as you like that your system can handle


Post a Comment