Answers.Body: <p>An image is treated by ffmpeg as video stream with one frame. For a crop animation to be effected, you need a stream of frames.</p>
  <p>Add loop before the image input: <code>-loop 1 -i $TST</code>. Normally, you would be advised to limit the duration by also adding <code>-t</code>, but since you limit duration on the output, it is not necessary here.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-06T18:28:32.113Z
Answers.LastActivityDate: 2021-03-06T18:28:32.113Z
Answers.UserDisplayName: Gyan
Body: <p><a href="https://video.stackexchange.com/questions/15417/moving-crop-in-video">moving crop</a> works for video, but I could not make it work for a (jpg) image. How to move an image in the video using ffmpeg?</p>
  <p>Here is my try that does not work (<code>$TST</code> is a <code>.jpg</code>):</p>
  <pre><code>ffmpeg -ss 30 -i main.mkv -i $TST -filter_complex \
      &quot;color=c=${CG}:size=1380x1080,[0]overlay,\
      chromakey=${CG}:.031:0.025,despill[a];[1]crop=w=1920:h=1080:x='t*in_w/3':y='t*in_h/3'[b];[b][a]overlay&quot; \
      -c:v ffv1 -map 0:a -c:a copy -t 1s tstres.mkv
  
  </code></pre>
  
Tags: <ffmpeg>
Title: How to move an (overlayed) image across a video in ffmpeg?
UserDisplayName: Roland Puntaier
ThreadText: # How to move an (overlayed) image across a video in ffmpeg?
  
  (Asked by: username_0 on 2021-03-06)
  
  [moving crop](https://video.stackexchange.com/questions/15417/moving-crop-in-video) works for video, but I could not make it work for a (jpg) image. How to move an image in the video using ffmpeg?
  
  Here is my try that does not work (`$TST` is a `.jpg`):
  
  ```
  ffmpeg -ss 30 -i main.mkv -i $TST -filter_complex \
      "color=c=${CG}:size=1380x1080,[0]overlay,\
      chromakey=${CG}:.031:0.025,despill[a];[1]crop=w=1920:h=1080:x='t*in_w/3':y='t*in_h/3'[b];[b][a]overlay" \
      -c:v ffv1 -map 0:a -c:a copy -t 1s tstres.mkv
  
  ```
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-06. Score: 1 | Accepted answer
  
  An image is treated by ffmpeg as video stream with one frame. For a crop animation to be effected, you need a stream of frames.
  
  Add loop before the image input: `-loop 1 -i $TST`. Normally, you would be advised to limit the duration by also adding `-t`, but since you limit duration on the output, it is not necessary here.
  
  
  ---
  
  