Reputation: 35
I am trying to concat a jpeg with a mp4, but when I concat both with this commands, the result is a video with the audio starting from the time 00:00:00, I want it to start along with the video in 0:0:10. So basically the idea of imageUrl is to have a sort of cover or presentation.
-loop 1 -t 10 -i ${imageUrl} -i ${videoUrl} -filter_complex "[0:v:0][1:v:0]concat=n=2:v=1:a=0" -r 60 -vn -y -c:a copy -s 640x352 ${outputUrl}
Any idea how I can fix it? thanks!
Upvotes: 1
Views: 734
Reputation: 133763
Add silent audio to the first input with the anullsrc filter:
ffmpeg -loop 1 -t 10 -framerate 25 -i input.jpg -f lavfi -t 10 -i anullsrc=r=44100:cl=stereo -i video.mp4 -filter_complex "[0][1][2:v][2:a]concat=n=2:v=1:a=1[vpre][a];[vpre]fps=60,scale=640:352[v]" -map "[v]" -map "[a]" ${outputUrl}
It is not possible to use the concat filter to concatenate an input without audio to an input with audio. Therefore, audio is needed for the first input because each input to be concatenated must have the same number of streams, same type of streams, and same attributes.
So you can use another file as the audio input for the JPG, or just generate silent audio like this example.
Upvotes: 2