0

I want to concat several videos using ffmpeg. I have 1.mp4 2.mp4 3.mp4 files I used this command

ffmpeg -y -i 1.mp4 -i 2.mp4 -i 3.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1]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]" -g 12 -c:v libx264 output.mp4

I expected the output.mp4 to be 30 seconds but it was 20 seconds long and the third video wasn't concatenated correctly.

If I try to concat using the same video like this

ffmpeg -y -i 1.mp4 -i 1.mp4 -i 1.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1]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]" -g 12 -c:v libx264 output.mp4

It worked.

Please help me solve this. Thanks

0

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.