I'm splitting and merging a single video clip using this ffmpeg command:
-ss 0 -t 1 -i C:\source.mp4
-ss 3 -t 1 -i C:\source.mp4
-ss 6 -t 1 -i C:\source.mp4
-ss 9 -t 1 -i C:\source.mp4
-filter_complex "[0:v][1:v][2:v][3:v]concat=n=4[outv];
[0:a][1:a][2:a][3:a]concat=n=4:=v=0:a=1[outa]" -map [outv] -map [outa]
-vcodec h264 -acodec aac -pix_fmt yuv420p -strict -2 C:\output.mp4
But if source file doesn't have audio track, this command fails. if I remove ;[0:a][1:a][2:a][3:a]concat=n=4:=v=0:a=1[outa] part it fixes the problem but I need to analyse file before using the command.
is there any parameter that will automaticly remove this part or ignores audio track if source doesnt have any audio track at all.