The Fastoe Blog

News and technical documents for all things Fastoe.

How to join multiple MP4 files into a single file on Windows?


If you want to show multiple videos together, for example for burning to a DVD or as part of an extended slideshow, you may wish to join multiple MP4 files into a single file.

To join multiple MP4 files into a single file we recommend that you use FFmpeg. FFmpeg is the leading multimedia framework to decode, encode, transcode, mux, demux, stream, filter and play. It is a simple, free tool available for Windows, MacOS, Linux.

Installing FFmpeg on Windows

  1. Head on over to https://ffmpeg.zeranoe.com/builds/ and download either the 32-bit or 64-bit Static version (depending on your system).
  2. Use 7-Zip to unpack it in the folder of your choice, like directly to your C:\ drive. It should create a folder like ffmpeg-4.2.2-win64-static, but just rename it to ffmpeg for simplicities sake.
  3. Open a command prompt with administrator's rights
    NOTE: Use CMD.exe, do not use Powershell! The syntax for accessing environment variables is different from the command shown in Step 4 - running it in Powershell will overwrite your System PATH with a bad value.
  4. Add to system path, run the command (see note below; in Win7 and Win10, you might want to use the Environmental Variables area of the Windows Control Panel to update PATH):
    setx /M PATH "path\to\ffmpeg\bin;%PATH%"

Using FFmpeg

Since FFmpeg is a command-line program, we’re going to need to open a command line! There are several ways to do this:

  1. Search in the start menu for command prompt or just cmd.
  2. Hit Win+R to open the Run utility and type cmd there.
  3. Shift+Right Click in a folder (without any files selected) and choose Open command window here. That’s what I usually do.

Once you’ve got a console open, check that FFmpeg is installed properly by typing ffmpeg -version, which will show you all the codecs you have access to, including audio and video.

If it still tells you that it doesn’t recognize the command, double check that you successfully added the ffmpeg bin folder to the system path.

If all is well – congratulations, it’s installed!

Ok, we will merge multiple MP4 files into one with ffmpeg. First, create a list of files you wish to merge.

Create a batch file and save to MP4 files directory with the following script:

:: / -------------------------------------------------------------------------- /
:: (C) fastoe.com
:: / -------------------------------------------------------------------------- /
@echo off
setlocal enabledelayedexpansion
set targe=''
set DIR=%~dp0
set ROOT=%DIR%

for /f "delims=" %%f in ('dir /b/a-d/s %ROOT%\*.mp4') do (
    set target=%%f
    echo file '!target!'>> filelist.txt
)

Second, with our shiny new list we can now tell ffmpeg to use it to concatenate to a single file:

ffmpeg -f concat -safe 0 -i path\to\filelist.txt -c copy output.mp4

Enjoy!