avconv -i concat:1.mp4\|2.mp4\|3.mp4 all.mp4Unfortunately, the above command did not produce the expected result. It threw an exception and stopped at the end of the first .mp4 file, which was also observed by a few frustrated users, e.g.,
- Merge video files using Concat filter in FFmpeg
- How to merge videos by avconv?
- Combining two video from ffmpeg
The solution to the problem is in fact included in the FAQ of libav and that of ffmpeg, which is suggested by a stackoverflow post and answer. Below is how I actually got it done,
avconv -i 1.mp4 1.mpegor
avconv -i 2.mp4 2.mpeg
avconv -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | avconv -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
ffmpeg -i 1.mp4 1.mpegThis solution is also suggested by a few posts, such as, this one, this one.
ffmpeg -i 2.mp4 2.mpeg
ffmpeg -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | ffmpeg -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
If you observe quality degradation in the resulting video, you may add the "-qscale" option, such as,
avconv -i 1.mp4 -qscale 1 1.mpegwhere the value of qscale is between 1 and 0 with 1 being the highest quality (also the largest file) and 0 being the lowest quality (also the smallest file).
Note that many web posts, when discussing the tools, refer the "sameq" option, which apparently not supported any more, as discussed here.
By the way, when I was looking for a solution to the "join-mp4-vidoe" problem, I happened to come across a post on the history of libav and ffmpeg that I enjoyed reading and that answers my question, "why are there two almost identical but different libraries and tools, libav and ffmpeg?"