<p>I have a png and would like to add there video, so png is my case is something like a border.</p>
<p>I trying :</p>
<pre><code>ffmpeg -i cat.mp4 -framerate 30 -i dem.png -filter_complex &quot;[0]pad=1920:1080:500:0[vid];[vid][1]overlay&quot; -c:a copy -movflags +faststart out2.mp4
</code></pre>
<p>But png is not a transparent and video hiding behind the picture. How can i set order or &quot;z-index&quot; position of the video to see it OVER the image?</p>
<p><a href="https://i.sstatic.net/qheSl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qheSl.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-07-28T04:11:25.417Z
Change `[vid][1]` to `[1][vid]`
Gyan
CC BY-SA 4.0
2022-07-28T07:39:24.383Z
@Gyan, in this case - png is not shown : https://c2n.me/4gfPjBc.png
Nigrimmist
CC BY-SA 4.0
2022-07-28T10:10:55.353Z
Likely because your png is smaller than the video. Pad the image, not the video, OR downscale the video.
Gyan
CC BY-SA 4.0
2022-07-28T13:56:09.043Z
@Gyan, png size is 600x554, mp4 is 148x114. I uploaded my files in case you would like to check them... https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing
Nigrimmist
CC BY-SA 4.0
2022-07-28T17:27:43.667Z
`-i cat.mp4 -framerate 30 -i dem.png -filter_complex "[1][0]overlay=x=W*.27:y=H*.58" -c:a copy -movflags +faststart out2.mp4`
Gyan
CC BY-SA 4.0
2022-07-29T10:18:23.497Z
@Gyan oh, man! thank you a lot! so magic :)
Nigrimmist
<ffmpeg>
Add video in front of image (background) using ffmpeg?
Nigrimmist
# Add video in front of image (background) using ffmpeg?

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

I have a png and would like to add there video, so png is my case is something like a border.
I trying :
ffmpeg -i cat.mp4 -framerate 30 -i dem.png -filter_complex "[0]pad=1920:1080:500:0[vid];[vid][1]overlay" -c:a copy -movflags +faststart out2.mp4

But png is not a transparent and video hiding behind the picture. How can i set order or "z-index" position of the video to see it OVER the image?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Change `[vid][1]` to `[1][vid]`  
> **username_0**: @username_1, in this case - png is not shown : https://c2n.me/4gfPjBc.png  
> **username_1**: Likely because your png is smaller than the video. Pad the image, not the video, OR downscale the video.  
> **username_0**: @username_1, png size is 600x554, mp4 is 148x114. I uploaded my files in case you would like to check them... https://drive.google.com/drive/folders/1gKJCyVU0IgJ8g3zWFhCA-L93lDOWyOS-?usp=sharing  
> **username_1**: `-i cat.mp4 -framerate 30 -i dem.png -filter_complex "[1][0]overlay=x=W*.27:y=H*.58" -c:a copy -movflags +faststart out2.mp4`  
> **username_0**: @username_1 oh, man! thank you a lot! so magic :)  

---

## 0 answers

