hack
hack

Reputation: 1603

FFMPEG- Is it possible to overlay multiple images over a video at specified intervals?

I want to overlay multiple images (Say 5) in a 120 second video at specified intervals , like, between 3-7 seconds overlay image 1. Is is it possible without splitting the video in multiple parts?

Upvotes: 15

Views: 14915

Answers (2)

Puratchi
Puratchi

Reputation: 29

The following code is working to create a video with multiple overlay images with specified duration.

ffmpeg -i video -i image1 -i image2 -i image3 
-filter_complex
"[0][1]overlay=y=H-h:enable='between(t,2,4)'[v1];
 [v1][2]overlay=y=H-h:enable='between(t,6,8)'[v2];
 [v2][3]overlay=y=H-h:enable='between(t,8,10)'[v3]"
-map "[v3]" outputVideo.mp4

Upvotes: 2

Gyan
Gyan

Reputation: 93369

Basic method is

ffmpeg -i video -i image1 -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

The last image will be overlaid from t=112 seconds till end of video.

Upvotes: 29

Related Questions