Answers.Body: <p>The overlay filter draws on each base or 'main' frame as given; it does not create new frames.</p>
  
  <p>In your command,</p>
  
  <pre><code>ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' ...
  </code></pre>
  
  <p>The <code>-r 2</code> sets the main video's framerate to 2, hence the result.</p>
  
  <p>Use</p>
  
  <pre><code>ffmpeg -hide_banner -y -loop 1 -framerate 30 -i 'bg.png' ...
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-10T14:51:54.240Z
Answers.Text: Yep, that's it! I remember adding -r 30 in front of the command but I completely missed that I also had the -r 2 in there, so it just got overridden. Thanks!
Answers.UserDisplayName: Rohan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-10T14:31:49.203Z
Answers.LastActivityDate: 2018-01-10T14:36:57.063Z
Answers.LastEditDate: 2018-01-10T14:36:57.063Z
Answers.UserDisplayName: Gyan
Body: <p>Using overlay to move a image from left to right feels very stuttery, as if it's moving every 0.5 second instead of per frame.</p>
  
  <p>Complete:  </p>
  
  <pre><code>ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' -i 'centerpiece.png' -t 30 -c:v libx264 -filter_complex "[1:v]scale=iw*2.2:ih*2.2[scaled_cen],[0:v][scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2,format=pix_fmts=yuv420p" -r 30 output.mp4
  </code></pre>
  
  <p>The important part is this:</p>
  
  <pre><code>[scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2
  </code></pre>
  
  <p>According to the <a href="https://ffmpeg.org/ffmpeg-filters.html#overlay-1" rel="nofollow noreferrer">ffmpeg docs</a>, <code>t</code> is evaluated in seconds, but I've read elsewhere that its evaluated in MS, in any case I'd like my centerpiece to move a little bit every frame.</p>
  
  <p>Here's the result of the command showing the choppyness:</p>
  
  <p><a href="https://i.imgur.com/PN4Ji1P.mp4" rel="nofollow noreferrer">https://i.imgur.com/PN4Ji1P.mp4</a></p>
  
  <p>So far i've tried things like the blur filter and minterpolate but I'm guessing the problem resides in getting <code>t</code> more granular or doing tricks with the fps.</p>
  
  <p>===EDIT====</p>
  
  <p>After applying the answer of Mulvya it still seemed a bit jittery, but adding:</p>
  
  <pre><code>tblend=average,framestep=2,setpts=0.25*PTS
  </code></pre>
  
  <p>at the end of the filter but before the <code>format</code> filter seems to do the trick.</p>
  
Tags: <ffmpeg>
Title: ffmpeg overlay image moving is choppy
UserDisplayName: Rohan
ThreadText: # ffmpeg overlay image moving is choppy
  
  (Asked by: username_0 on 2018-01-10)
  
  Using overlay to move a image from left to right feels very stuttery, as if it's moving every 0.5 second instead of per frame.
  
  Complete:
  
  ```
  ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' -i 'centerpiece.png' -t 30 -c:v libx264 -filter_complex "[1:v]scale=iw*2.2:ih*2.2[scaled_cen],[0:v][scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2,format=pix_fmts=yuv420p" -r 30 output.mp4
  
  ```
  
  The important part is this:
  
  ```
  [scaled_cen]overlay=(main_w-overlay_w)/3+(t*10):(main_h-overlay_h)/2
  
  ```
  
  According to the [ffmpeg docs](https://ffmpeg.org/ffmpeg-filters.html#overlay-1), `t` is evaluated in seconds, but I've read elsewhere that its evaluated in MS, in any case I'd like my centerpiece to move a little bit every frame.
  
  Here's the result of the command showing the choppyness:
  
  <https://i.imgur.com/PN4Ji1P.mp4>
  
  So far i've tried things like the blur filter and minterpolate but I'm guessing the problem resides in getting `t` more granular or doing tricks with the fps.
  
  ===EDIT====
  
  After applying the answer of Mulvya it still seemed a bit jittery, but adding:
  
  ```
  tblend=average,framestep=2,setpts=0.25*PTS
  
  ```
  
  at the end of the filter but before the `format` filter seems to do the trick.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-10. Score: 1 | Accepted answer
  
  The overlay filter draws on each base or 'main' frame as given; it does not create new frames.
  
  In your command,
  
  ```
  ffmpeg -hide_banner -y -loop 1 -r 2 -i 'bg.png' ...
  
  ```
  
  The `-r 2` sets the main video's framerate to 2, hence the result.
  
  Use
  
  ```
  ffmpeg -hide_banner -y -loop 1 -framerate 30 -i 'bg.png' ...
  
  ```
  
  > **Comments:**
  > **username_0**: Yep, that's it! I remember adding -r 30 in front of the command but I completely missed that I also had the -r 2 in there, so it just got overridden. Thanks!  
  
  ---
  
  