How to combine/merge mp4 videos with FFMPEG
- March 17, 2015
- M M Arif
FFMPEG is a useful library, i would say quite useful to do many things with it like converting videos, resizing videos etc. It can do more than that if used properly. I remember i used it quite heavily for a project where i need to do all sort of things for images and videos and it never fails in any. The other day i was recording some in game videos and the videos were big like 8GB, so the recording application(Nvidia shadowplay) divided into two parts. I assume at the moment it only would go for around 4GB file and the rest it just split it to sequential files. So i thought why not use FFMPEG and merge them together without losing any frames and quality. CAT can be used too for merging in terminal. Enough of talking, lets get into action. Open terminal, if ffmpeg is not installed, install it via zypper, yum etc. You should have Packman repo in openSUSE for this.
sudo zypper in ffmpeg
Now lets say we have 3 files to merge together f1.mp4, f2.mp4, f3.mp4. CD to the dir where the files are and create a txt file:
Add the following to the files.txt in vim or any GUI app.
Lets merge them together:
ffmpeg -f concat -i files.txt -vcodec copy -acodec copy final_file.mp4
And you have a merged file now. 🙂