0

I have 4 files with same encoding to concatenate

  • "video1.mp4": duration 3 seconds. Show time from 00:00 to 00.03
  • "video2.mp4": duration 1 second. Show time from 00:01 to 00.02
  • "video3.mp4": duration 2 seconds. Show time from 00:01 to 00.03
  • "video4.mp4": duration 2 seconds. Show time from 00:03 to 00.05

What commands to get the following output?

00:00

00:01 to 00:02

00:03

00:03 to 00:05

1 Answer 1

2

Basic syntax is

ffmpeg -i video1 -i video2 -i video3 -i video4
       -filter_complex "[1]scale=0.40*iw:-1,setpts=PTS-STARTPTS+1/TB[v2];
                        [2]scale=0.40*iw:-1,setpts=PTS-STARTPTS+1/TB[v3];
                        [0][v2]overlay=x=W-w-20:y=H-h-20:eof_action=pass[m2];
                        [m2][v3]overlay=x=W-2*w-40:y=H-h-20:eof_action=pass[m3];
                        [m3][3]concat=n=2:v=1:a=0"   out.mp4

I assume all videos have same resolution and framerate. I've scaled videos 2 and 3 to 40% before overlay and offset their start time to 1 second.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.