<p>Use</p>

<p>for 10% space from right, and 3% from top,</p>

<pre><code>"[0:v][1:v] overlay=x='0.90*W-w':y='0.03*H'"
</code></pre>

<p>for 10 px from right, and 5 px from top,</p>

<pre><code>"[0:v][1:v] overlay=x='W-10-w':y='5'"
</code></pre>

CC BY-SA 4.0
2019-06-01T05:00:02.150Z
2019-06-01T05:00:02.150Z
Gyan
<p><br>
I want to overlay an image on top of a video and have reached these two links:
<br>
<a href="https://stackoverflow.com/questions/40480153/how-to-overlay-place-an-image-on-a-video-in-ffmpeg">How to overlay/place an image on a video in ffmpeg [duplicate]</a>
<br>
<a href="https://video.stackexchange.com/questions/12105/add-an-image-overlay-in-front-of-video-using-ffmpeg">Add an image overlay in front of video using ffmpeg</a>
<br>
And this is my command:
<br></p>

<pre><code>ffmpeg -i flower.mp4 -i rose.png \
-filter_complex "[0:v][1:v] overlay=W-w/2:H-h/2" \
-pix_fmt yuv420p -c:a copy flowers.mp4 -y
</code></pre>

<p>But I have not reached the thing I want yet.
<br>
I want the image be placed in top right with 10 percent space from right and 3 percent from top, or 10px from right and 5px from top right.
<br>
<a href="https://i.sstatic.net/mtDes.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mtDes.png" alt="https://i.imgur.com/ZRbMFHx.png"></a>
<br>
How to reach this to work with my desired percent?
<br>
There are some other videos with different scales, so I cannot use fix x and y for all of them.
<br>
Thanks in advance</p>

<ffmpeg>
How to overlay an image over video in percent
Saeed
# How to overlay an image over video in percent

(Asked by: username_0 on 2019-05-31)

I want to overlay an image on top of a video and have reached these two links:

How to overlay/place an image on a video in ffmpeg [duplicate]

Add an image overlay in front of video using ffmpeg

And this is my command:

ffmpeg -i flower.mp4 -i rose.png \
-filter_complex "[0:v][1:v] overlay=W-w/2:H-h/2" \
-pix_fmt yuv420p -c:a copy flowers.mp4 -y

But I have not reached the thing I want yet.

I want the image be placed in top right with 10 percent space from right and 3 percent from top, or 10px from right and 5px from top right.



How to reach this to work with my desired percent?

There are some other videos with different scales, so I cannot use fix x and y for all of them.

Thanks in advance

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2019-06-01. Score: 5 | Accepted answer

Use
for 10% space from right, and 3% from top,
"[0:v][1:v] overlay=x='0.90*W-w':y='0.03*H'"

for 10 px from right, and 5 px from top,
"[0:v][1:v] overlay=x='W-10-w':y='5'"


---

