I have videos and images. I want to concatenate them. And I want the images to be displayed for specific duration, say 10 seconds. If I first convert image to video and concate, it works

ffmpeg -y -loop 1 -t 10 -i missing.png -c:v libx264 -pix_fmt yuv420p 7.mp4 

ffmpeg -y -i 5.mp4 -i 7.mp4 -i 2.mkv -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1:v]trim=0:10,scale=1920:1080,setsar=1[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -c:v libx264 -r 30 output.mkv

But I want to do it with one ffmpeg command. for example

ffmpeg -y -i 5.mp4 -loop 1 -t 10 -i missing.png -i 5.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1,format=yuv420p,fps=30[v0];[1]format=yuv420p,scale=1920:1080,setsar=1,fps=30[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1,format=yuv420p,fps=30[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -c:v libx264 -r 30 -pix_fmt yuv420p output.mkv

I expected above command to be working but it didn't. It only concate the first video and 10 seconds of image. Only a few frames of the third video were added and the duration of output video was only 20 seconds. I expected it to be 30 seconds.

Please help me what is wrong or provide me such ffmpeg command Thanks


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.