0

I need to encode multiple images over the same video at different times in a single pass.

I have a fair grasp of doing this with a single image, such as

ffmpeg -i video.mp4 -i picture1.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,1,5)'" -pix_fmt yuv420p -c:a copy result.mp4

but how would I go about adding a picture2.png, picture3.png, and so on, with different between() parameters?

1

Add all the images you want to overlay to a video file as input -i

Here -

  1. X,Y are the top left coordinates where the image should be put, with respect to video
  2. Between(t,a,b) means you want to display that image from a (in seconds) till b (in seconds)
  3. gt(t,c) means that display that image from c till the end of video

ffmpeg -i video -i image1.png -i image2 -i image3 -filter_complex "[0][1]overlay=x=X:y=Y:enable='between(t,23,27)'[v1]; [v1][2]overlay=x=X:y=Y:enable='between(t,44,61)'[v2]; [v2][3]overlay=x=X:y=Y:enable='gt(t,112)'[v3]" -map "[v3]" -map 0:a out.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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