0

I'm trying to overlay a 15 second video transition on the beginning of an image sequence (png sequence with an alpha to reveal the image below), which I can do fine with the overlay filter. But I want to hold the first frame of the image sequence for 5 seconds before playing the animation. I've tried trim/select but I can't seem to get it be a duration of 5 seconds, I also can't seem to concat it back with the other video to do the transition. So my questions are:

  1. How do I get the first frame and hold it for 5 seconds, the method below works but doesn't seem like the best method?

-start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1_%03d.png -filter_complex "color=c=red:d=5:s=480x270:r=30[bg]; [bg][1:v]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[out]"

  1. Can I then easily concat that with the original or is it better to do two overlays with the start of the actual transition offset by the length of the hold?

Thanks

Nick

1
  • For the 2nd question my code would look like this: -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg -framerate 30 -t 15.0 -i transition1_%03d.png -filter_complex "color=c=red:d=5:s=480x270:r=30[bg]; [1:v]split[trans][transhold]; [trans]setpts=PTS+5/TB[trans];[transhold]select=eq(n\0)[transhold];[bg][transhold]overlay[transhold]; [0:v][transhold]overlay=repeatlast=0[tmp1]; [tmp1][trans]overlay[out]" Commented Mar 8, 2018 at 11:09

1 Answer 1

1

Use

ffmpeg -start_number 501 -framerate 30 -t 60.0 -i input1.%04d.jpg 
       -framerate 30 -t 15.0 -i transition1_%03d.png
       -filter_complex "[0]loop=149:1:0[bgheld5];
                        [1]loop=149:1:0[fgheld5];
                        [bgheld5][fgheld5]overlay=eof_action=pass"  out.mp4

The first frames of both sequences are repeated 149 times, so that there are 150 instances (30 fps x 5s). The 0 at the end of loop is the starting index of the frame(s) to loop. The middle 1 is the number of frames to loop starting at the index in the 3rd argument.

1
  • Great, that's pretty much exactly what I was looking for. The only difference is I don't need to loop the first input so my filter is "[1]loop=149:1:0[trans];[0][trans]overlay=eof_action=pass" Commented Mar 8, 2018 at 12:42

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.