<p>This works like a charm :</p>
<pre><code>ffmpeg -y -i cat.mp4 -framerate 20 -i dem.png -filter_complex &quot;[0:v]scale=512x397,setsar=1[v0];[1][v0]overlay=x=45:y=45&quot; -c:a copy -movflags +faststart out2.mp4
</code></pre>
<p>Result will be :</p>
<p><a href="https://i.sstatic.net/bIhcC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bIhcC.png" alt="enter image description here" /></a></p>
<p>If anyone can step-by-step describe what each part of command do - will appreciate!</p>

CC BY-SA 4.0
2022-07-29T21:09:50.157Z
2022-07-29T21:09:50.157Z
Nigrimmist
<p>What i have :</p>
<p>png picture dem.png (not transparent) and video cat.mp4. I need to put this png as a background to video with resizing video inside.</p>
<p>Current result :</p>
<p><a href="https://i.sstatic.net/c2ZQ8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c2ZQ8.png" alt="enter image description here" /></a></p>
<p>by executing :</p>
<pre><code>ffmpeg -i cat.mp4 -framerate 30 -i dem.png -filter_complex &quot;[1][0]overlay=x=100:y=100&quot; -c:a copy -movflags +faststart out2.mp4
</code></pre>
<p>How can i scale mp4 in case i know paddings/required height/width of scaled mp4 here?</p>
<p>Very beginner in ffmpeg. I know, i need to use <code>scale</code> param, but can't understand how to do it with my current ffmpeg command.</p>
<p>Maybe someone know how to do it?</p>
<p>Files are here if you need : <a href="https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing</a></p>

<ffmpeg>
How to put an image on top of video using ffmpeg? +scale video
Nigrimmist
# How to put an image on top of video using ffmpeg? +scale video

(Asked by: username_0 on 2022-07-29)

What i have :
png picture dem.png (not transparent) and video cat.mp4. I need to put this png as a background to video with resizing video inside.
Current result :

by executing :
ffmpeg -i cat.mp4 -framerate 30 -i dem.png -filter_complex "[1][0]overlay=x=100:y=100" -c:a copy -movflags +faststart out2.mp4

How can i scale mp4 in case i know paddings/required height/width of scaled mp4 here?
Very beginner in ffmpeg. I know, i need to use scale param, but can't understand how to do it with my current ffmpeg command.
Maybe someone know how to do it?
Files are here if you need : https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_0 on 2022-07-29. Score: 1

This works like a charm :
ffmpeg -y -i cat.mp4 -framerate 20 -i dem.png -filter_complex "[0:v]scale=512x397,setsar=1[v0];[1][v0]overlay=x=45:y=45" -c:a copy -movflags +faststart out2.mp4

Result will be :

If anyone can step-by-step describe what each part of command do - will appreciate!


---

