I have 2 same videos. One of the videos doesn't have audio and I want to concat
them.
video1 = 1 video stream + 1 audio stream.
video2 = 1 video stream.
the result should be 1(concatenated) video stream, 1 audio stream
I have tried
ffmpeg -i videoonly.mov -i video+audio.mov -filter_complex "[0:v][0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" out.mov
but it doesn't work and prints the error message
Stream specifier ':a' in filtergraph description [0:v][0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a] matches no streams.
I except this kind of error message because the second video doesn't have the audio and I sepcifyed the audio but the question is how to make it work or is it possible?
Thanks in advance.
The concat filter expects matching pairs in each segment, so if one of the segment does not have audio, you should supply a dummy stream. Below, I use the anullsrc filter to generate one.
ffmpeg -i videoonly.mov -i video+audio.mov -f lavfi -t 1 -i anullsrc -filter_complex "[0:v][2:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" out.mov