How to merge three mp4 files with same encoding/codex by Avidemux using command line?
Assume that one has three mp4 files with the same encoding/codex, say file1.mp4, file2.mp4, file3.mp4.
How can one merge these files into a single mp4 file, using command line by avidemux?
Solution 1:
This works for me:
avidemux3_cli --load file1.mp4 --append file2.mp4 --append file3.mp4 --video-codec copy --audio-codec copy --output-format mp4 --save merged.mp4
From avidemux man page:
--load filename
load video or workbench
--append filename
append a video
--video-codec codec
set video codec (Divx/Xvid/FFmpeg4/VCD/SVCD/DVD/XVCD/XSVCD/COPY)
--audio-codec codec
set audio codec (MP2/MP3/AC3/NONE (WAV PCM)/TWOLAME/COPY)
--output-format format
set output format (AVI|OGM|ES|PS|AVI_DUAL|AVI_UNP|...), often named as container format
--save filename
save as avi file
See the rest of the avidemux man page for more information.
While not directly an answer to your question, I would personally use ffmpeg and its concat demuxer for this as it is more powerful (e.g. subtitles support).
$ echo "file 'file1.mp4'" > list.txt
$ echo "file 'file2.mp4'" >> list.txt
$ echo "file 'file3.mp4'" >> list.txt
$ ffmpeg -f concat -safe 0 -i list.txt -c copy merged.mp4
For more information on the ffmpeg approach, this Stack Overflow question has some good information (as does ffmpeg man page, of course).