<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>

CC BY-SA 4.0
2018-06-14T14:15:50.007Z
2018-06-14T14:15:50.007Z
aclab28
<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>

CC BY-SA 4.0
2018-06-13T05:41:19.857Z
See answer - especially 2nd method - at https://superuser.com/q/1100368/114058
Gyan
<video><ffmpeg>
How to set an image height & width on a video in ffmpeg
Dhrubajyoti Dutta
# 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
Image - 2

**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


---

