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

1 Answer 1



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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.