FFmpeg only merges 1 video when using -filter_complex
concat filter
The concat protocol should not be used with MP4. This is a common mistake. You can use the concat filter instead:
ffmpeg -i GX014185.MP4 -i GX024185.MP4 -i GX034185.MP4 -i GX044185.MP4 -i GX054185.MP4 -i scaled.png -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a][3:v][3:a][4:v][4:a]concat=n=5:v=1:a=1[vv][a];[vv]overlay=main_w-overlay_w-5:main_h-overlay_h-5[v]" -map "[v]" -map "[a]" output.mp4
The concat filter is most useful with filtering since it requires the video to be re-encoded (all filters require re-encoding).
Because you have to re-encode, due to the overlay, this can take some time.
concat demuxer
Alternatively you could use the concat demuxer. First make a text file named input.txt
:
file "GX014185.MP4"
file "GX024185.MP4"
file "GX034185.MP4"
file "GX044185.MP4"
file "GX054185.MP4"
Then run ffmpeg
:
ffmpeg -f concat -i input.txt -i scaled.png -filter_complex "overlay=main_w-overlay_w-5:main_h-overlay_h-5" output.mp4
The concat demuxer is useful to concatenate videos without needing to re-encode (when used with -c copy
), but it is also just as good when you need to re-encode (such as due to any filtering).
Because you have to re-encode, due to the overlay, this can take some time.