Merging several videos with audio channel and without audio

Solution 1:

FFmpeg is expecting an audio stream to pair with the 2nd video. Since there isn't one, you'll have to supply a dummy one.

Since you aren't sure if the inputs have audio, run this command for each input:

ffmpeg -i <input> -f lavfi -i anullsrc -c:v copy \
-map 0:v -map 0:a? -map 1:a -shortest <output>

And then, with the processed files

ffmpeg.exe -i <input1> -i <input2> \
-filter_complex \
"[0:v]scale=1280:720, setsar=1/1, setpts=PTS-STARTPTS[v0]; \
 [1:v]scale=1280:720, setsar=1/1, setpts=PTS-STARTPTS[v1]; \
 [v0][0:a] [v1][1:a] concat=n=2:v=1:a=1[v][a]" \
-map "[v]" -vcodec libx264 -b:v 512k -pix_fmt yuv420p \
-map "[a]" -acodec libfaac -b:a 128k -ar 44100 \
-movflags faststart -y "result.mp4"