I have been struggling with .mp4's for about 2 days now, trying to concatenate a series of about 20 into 1 single file. Any differences between the files and it is a nightmare. Some files have different fps, and others different ratios.
I wanted to know if mp4 is the format I should be using, or if there is a better, easy to use format for concatenation. Time isn't an issue, I simply need a relatively high-quality format that concatenates under most circumstances.
If this doesn't exist, any suggestions on how to deal with massively varying properties of mp4 files (I'm not entirely sure of what can differ aside from fps and ratio between videos that may cause a problem) would be great.
I am using ffmpeg to try and concatenate the files. First I tried to use the demuxer, and then the concat filter, however I find the concat filter very daunting and am completely at a loss as to how to use it.
Each video has audio, some have still images while others have moving.
Best Answer
Multimedia files are complex, so concatenation has several requirements:
Since each input may vary in any arbitrary parameter I recommend using the concat filter. You will have to conform each input to a common set of parameters using filters. The input format doesn't matter so much because you're going to re-encode everything anyway.
Basic, generic example where
main.mp4
has video and audio andend.mp4
has video and no audio. All other parameters are assumed to be different. The filters used here are: anullsrc, scale, pad, setsar, fps, format, aformat, and concat.There are several ways to do this, and you may have to make adjustments based on your inputs or to fit your requirements.