[FFmpeg-user] Use ffmpeg to watermark and scale an image on video

daad at libero.it daad at libero.it
Tue Nov 22 22:13:21 CET 2011


I want to be able to watermark videos with a logo image, which contains a 
website url. The videos can be of different formats and dimension. I'm trying 
to figure out a generic ffmpeg command to achieve it, so that i don't have to 
tweak the command depending on the video i have to process. So far i got:

ffmpeg -i sample.mov -sameq -acodec copy -vf 'movie=logo.png [watermark]; [in]
[watermark] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]' sample2.mov

In this way though the logo will look too big or too small with video of 
different size. I've seen there is a scale option for avfilter but that will 
scale the video, not the watermarked image (i guess?), but I haven't figure out 
whether it's possible to resize the image logo based on the dimension of the 
input video, so that I can say to scale the logo width to 1/3 of the video 
width for example, and keep the image ratio.

Any idea? doesn't need to be done in a single command, could even be a 
script. 
thanks in advance.


More information about the ffmpeg-user mailing list