The robust video processing tool FFmpeg allows users to alter audio and video formats, concatenate files, trim, compress videos, and so on. It is a powerful video editing tool that users can use to concatenate videos quickly and easily. This free file converter post from MiniTool will give you a practical FFmpeg merge videos tutorial.

Nowadays, with the rise of short video software, there are more and more video creators increasing the demand for video editing. In this article, we will show you some methods for merging video files using the FFmpeg command line editor.

Merging Videos with the Same Codecs

Method 1: Using the FFmpeg “concat” Demuxer

Firstly, create a .txt file in the Command Prompt window, and then list the paths of the video files you wish to merge. For example:

  • merge_video.txt
  • File /Users/Video/input1.mp4
  • File /Users/Video/input2.mp4

You can also add more videos to the .txt list.

Secondly, run the FFmpeg command:

ffmpeg -f concat -safe 0 -i join_video.txt -c copy output_demuxer.mp4

-safe 0 is for any name of the file that will work.

-c copy is for duplicating every stream.

Method 2: Using the FFmpeg “concat” Protocol

Only video formats that support five-level concatenation like MPEG-2 TS can use the “concat” protocol:

ffmpeg -i “concat:input1.ts|input2.ts” -c copy output_protocol.ts

Merging Videos with Different Codecs

Not all video files use the same codecs. In certain cases, the video you wish to combine may use different codecs. In that case, using the previously mentioned methods is impossible. So, you have to use the FFmpeg concat filter to combine two videos with different formats. Make sure that the video’s dimensions and frame rate are the same. Then run the FFmpeg command, taking combining an MP4 video and a WMV video for example:

ffmpeg -i input1.mp4 -i input2.wmv -filter_complex “[0:0][0:1][1:0][1:1]concat=n=2:v=1:a=1[outv][outa]” -map “[outv]” -map “[outa]” output.mp4

-filter_complex enables the concat filter to be used with multiple inputs and outputs.

[0:0][0:1] and [1:0][1:1] get video stream 0 and audio stream 1 from the first input video and the second input video independently.

n=2 means the number of input videos.

v=1 and a=1 are the quantity of output video streams and audio streams.

[outv] and [outa] are the generated audio and video streams.

The process of merging the videos will take a long time because they must be re-encoded.

Merging Videos by Using MiniTool MovieMaker

Merging videos with FFmpeg can be difficult and time-consuming when the videos have different codecs, resolutions, frame rates, streams, and so on. It works in command lines, so perhaps you will type those elements incorrectly. Therefore, I highly recommend an easy-to-use video combiner- MiniTool MovieMaker.

This software is free and professional and allows you to merge videos from different codecs, formats, resolutions, and frame rates as much as you can. Its intuitive interface is friendly to a beginner. Now, let’s see how to merge videos by using it:

Step 1: Click the download button below to download and install MiniTool MovieMaker.

MiniTool MovieMakerClick to Download100%Clean & Safe

Step 2: Launch this software to enter its main interface. If you don’t need to create a new project, just close the promotion window.

Step 3: Click the Import Media Files button to add videos. Or you can just drag and drop videos to the Import Media Files area.

add videos

Step 4: Drag every video clip to the video track on the timeline.

drag video clips to the track

Step 5: You can edit the video by trimming, cropping, adding effects, adding text, and more. Click the Export button at the right top to output the file.

click the Export button

Step 6: Click the Settings button to expand the settings window. Then you can choose the video quality, encoder, bitrate, and so on. Then click the OK button.

the Settings window

Step 7: You can rename the output video file, and select the output destination and the output format, the resolution, and the frame rate. Also, you can click the Device button to select an output format that the smartphone supports. When everything is done, click the Export button. You can click the Find Target button to check the file in your local folder.

select output parameters
Tips:
If you want to convert merged video to another format, I highly recommend MiniTool Video Converter to you. It is an easy-to-use and robust video converter that supports many video and audio formats. You can click the download button below to give it a try.

MiniTool Video ConverterClick to Download100%Clean & Safe

Conclusion

The above is all about methods of FFmpeg merge videos. Apart from merging videos with FFmpeg, an alternative also be mentioned. With these practical tutorials, hope you can enjoy your video merging experience!

  • linkedin
  • reddit