I have 15 video files which I want to merge with ffmpeg. I want to save time by merge all of the video files in a single command line, not cut it one by one and merge it. Thanks.


Use the concat demuxer.

First, create a text file with the filenames.

file '1.mp4'
file '2.mp4'
file '3.mp4'
file '13.mp4'
file '14.mp4'
file '15.mp4'

Then, run the concat command.

ffmpeg -f concat -i textfile -c copy -fflags +genpts merged.mp4

For this to work, all videos should have same properties such as codec, resolution, framerate, sample rate, etc.

If they are not, you can encode the concat.

ffmpeg -f concat -i textfile -fflags +genpts merged.mp4

Also see FFmpeg Wiki: Concatenate.

  • Please explain how to "encode the concat". The command line you have provided for this does not work for me. Could you perhaps provide an example? – Arete Mar 18 '17 at 14:43
  • @Arete Post a new Q with log of your ffmpeg command execution as well as properties of the input files + the list as well. – Gyan Mar 18 '17 at 15:33
  • Second command is working well but audio is missing! – Jay Patel Mar 20 '18 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.