FFmpeg: How to Join Multiple Videos Together

In this tutorial, we will learn how to join multiple video files in a directory into one video file using FFmpeg.


Before beginning make sure you have the latest version of FFmpeg installed on your system.


Create a List of Files

The first step is to create a .txt file containing a list of files to concatenate in this format:


file 'path/to/file/sample_1.mp4'
file 'path/to/file/sample_2.mp4'
file 'path/to/file/sample_3.mp4'


The easiest thing to do is create a list.txt in the same directory as your videos, that way you just have to supply the file name.


file 'sample_1.mp4'
file 'sample_2.mp4'
file 'sample_3.mp4'


The FFmpeg command

Now let's create the FFmpeg terminal command that will concatenate the videos together and take a closer look at what each part of it is doing.


ffmpeg -f concat -safe 0 -i list.txt output.mp4


  • -f concat – this forces ffmpeg to use concat mode for the output file.
  • -safe 0 – this is needed if absolute paths are provided as the input.
  • -i list.txt – the path to the list of input files, if your current working directory is where this file is you can supply the file name only.
  • output.mp4 – the path for the output file.



When you run the above command it will start concatenating the files together.


Concat Progress



FFmpeg is an advanced program and will handle concatenating videos in multiple resolutions and formats automatically with a simple command like the one in this tutorial.