Answers.Body: <p>You can add a scale filter. This will scale the image to 50x50:</p>
  
  <pre><code>ffmpeg -i in.mkv -i 3.png -filter_complex "[1]scale=50:50[b];[0][b] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause
  </code></pre>
  
  <p>If you want to scale the width or height and maintain the aspect ratio, use -1. For example, this scales the width to 50 and the height according to the aspect ratio. </p>
  
  <pre><code>scale=50:-1
  </code></pre>
  
  <p>Conversely, this scales the height to 50 and the width is adjusted by aspect ratio.</p>
  
  <pre><code>scale=-1:50
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-14T14:15:50.007Z
Answers.LastActivityDate: 2018-06-14T14:15:50.007Z
Answers.UserDisplayName: aclab28
Body: <p>I have many videos and I need to put an image in them for about 20 seconds, I am adding them manually and it works fine if only the image is small in size....
  please, help me out to set height and width on the image</p>
  
  <p>The original command is this</p>
  
  <pre><code>ffmpeg -i in.mkv -i 3.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause
  </code></pre>
  
  <p>But it give me output as these image below</p>
  
  <p><a href="https://i.sstatic.net/YM5Zb.jpg" rel="nofollow noreferrer">Image - 1</a>
  <a href="https://i.sstatic.net/P4xko.jpg" rel="nofollow noreferrer">Image - 2</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-13T05:41:19.857Z
Comments.Text: See answer - especially 2nd method - at https://superuser.com/q/1100368/114058
Comments.UserDisplayName: Gyan
Tags: <video><ffmpeg>
Title: How to set an image height & width on a video in ffmpeg
UserDisplayName: Dhrubajyoti Dutta
ThreadText: # How to set an image height & width on a video in ffmpeg
  
  (Asked by: username_0 on 2018-06-13)
  
  I have many videos and I need to put an image in them for about 20 seconds, I am adding them manually and it works fine if only the image is small in size....
  please, help me out to set height and width on the image
  
  The original command is this
  
  ```
  ffmpeg -i in.mkv -i 3.png -filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause
  
  ```
  
  But it give me output as these image below
  
  [Image - 1](https://i.sstatic.net/YM5Zb.jpg)
  [Image - 2](https://i.sstatic.net/P4xko.jpg)
  
  **Tags:** video, ffmpeg
  
  > **Comments:**
  > **username_1**: See answer - especially 2nd method - at https://superuser.com/q/1100368/114058  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-06-14. Score: 4 | Accepted answer
  
  You can add a scale filter. This will scale the image to 50x50:
  
  ```
  ffmpeg -i in.mkv -i 3.png -filter_complex "[1]scale=50:50[b];[0][b] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy tout.mkv pause
  
  ```
  
  If you want to scale the width or height and maintain the aspect ratio, use -1. For example, this scales the width to 50 and the height according to the aspect ratio.
  
  ```
  scale=50:-1
  
  ```
  
  Conversely, this scales the height to 50 and the width is adjusted by aspect ratio.
  
  ```
  scale=-1:50
  
  ```
  
  
  ---
  
  