[HowTo] Merge videos with ffmpeg

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
Level 2
Level 2
Posts: 95
Joined: Tue Mar 10, 2020 12:06 am

[HowTo] Merge videos with ffmpeg

Post by cpedretti »

FFmpeg is a collection of open source software intended for processing audio or video streams. Source

Be sure that you have the last version of ffmpeg:

Code: Select all

ffmpeg -version
You will see an output of your version, in my case i have the last stable version 4.1.6.

No output??? Whaaaat!!! Don't panic on the Titanic, we need just to install the package:

Code: Select all

sudo apt update && sudo apt upgrade -y
sudo apt install ffmpeg -y

Go to the Videos folder and we create an file like this, necessary to concat later:

Code: Select all

file '/path_to_my_file/part1.mp4'
file '//path_to_my_file/part2.mp4'
file '/=/path_to_my_file/part3.mp4'
then save the file with a name of your choice in .txt output, in my example merge.txt.

Now we can merge our vids, the per-file main options retained are:

-f input/output with the concat option
-i input file or url
-c codec or stream output with the copy option

Code: Select all

 ffmpeg -f concat -safe 0 -i merge.txt -c copy my_vids.mp4

After a few moments you can see your new merged video.

Enjoy! :D

AMD Ryzen 7 3700X - 32GB DDR4 - Sapphire RX570 8GB - SSD SAMSUNG EVO 860/HDD Toshiba - Mobo Gigabyte AORUS ELITE B450 - PSU Gigabyte 750W Gold - Case Zalman X3 White

Mint 20.1 Kernel 5.8
Post Reply