In FFmpeg merging files together is called concatenation.
The video files have to have the same codec. Different file containers are allowed though.
For the concatenation to work we need to make a list of every file we want to include in the output. The list should have the following format:
file '001.mp4'
file '002.mp4'
file '003.mp4'
Remember that the order of the list will determine the order of the videos in the output, so do it right!
In windows you can use the following command to make a list for all files in a folder (of a certain type):
(for %i in (*) do @echo file '%i') > list.txt
Now that you have the file you can run the following command (given that the text file is in the same location as the video files).
ffmpeg -f concat -i list.txt -c copy output.mp4
This will merge all the MP4 files in the directory and save them as output.mp4.
As a bonus, if you are using Directory Opus like me you can make a button with the command:
Clipboard COPYNAMES=nopaths REGEXP "(.*)" "file '\1'" Clipboard PASTE AS list.txt ffmpeg.exe -f concat -i list.txt -c copy "{d!}merged-video.mp4" del list.txt
Stitch that shit together! 😎
Sources: