Answers.Body: <p>Add all the images you want to overlay to a video file as input <code>-i</code></p>
  <p>Here -</p>
  <ol>
  <li>X,Y are the top left coordinates where the image should be put, with respect to video</li>
  <li>Between(t,a,b) means you want to display that image from a (in seconds) till b (in seconds)</li>
  <li>gt(t,c) means that display that image from c till the end of video</li>
  </ol>
  <blockquote>
  <p>ffmpeg -i video -i image1.png -i image2 -i image3  -filter_complex
  &quot;[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]&quot;
  -map &quot;[v3]&quot; -map 0:a  out.mp4</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-09T12:04:56.997Z
Answers.LastActivityDate: 2021-01-09T12:04:56.997Z
Answers.UserDisplayName: jsdbt
Body: <p>I need to encode multiple images over the same video at different times in a single pass.</p>
  <p>I have a fair grasp of doing this with a single image, such as</p>
  <pre><code>ffmpeg -i video.mp4 -i picture1.png -filter_complex &quot;[0:v][1:v] overlay=0:0:enable='between(t,1,5)'&quot; -pix_fmt yuv420p -c:a copy result.mp4
  </code></pre>
  <p>but how would I go about adding a picture2.png, picture3.png, and so on, with different between() parameters?</p>
  
Tags: <ffmpeg>
Title: Overlay multiple images on one video using ffmpeg?
UserDisplayName: Eslake
ThreadText: # Overlay multiple images on one video using ffmpeg?
  
  (Asked by: username_0 on 2021-01-09)
  
  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?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-09. Score: 2
  
  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
  
  
  ---
  
  