I am currently using these commands:
Top left corner
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv
Top right corner
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv
Bottom left corner
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]" outputvideo.flv
Bottom right corner
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 [out]" outputvideo.flv
How to place watermark center of the video ?
Best Solution
Examples to add a watermark / logo image on video using the overlay filter.
Centered
or with the shortened overlay options:
Top left
This is the easy one because the default, if you provide no options to overlay, is to place the image in the top left.
This example adds 5 pixels of padding so the image is not touching the edges:
Top right
With 5 pixels of padding:
or with the shortened options:
Bottom right
With 5 pixels of padding:
or with the shortened options:
Bottom left
With 5 pixels of padding:
or with the shortened options:
Transparency / opacity / alpha
Example to make watermark 50% transparent using the format and colorchannelmixer filters:
Improved quality
Using the
format=auto
option in the overlay filter can make PNG watermarks look better:Note the addition of the format filter (yes, same name as the option, but a standalone filter) to reset it to YUV 4:2:0 which is needed for MP4 output. Remove
,format=yuv420p
if you are not outputting MP4.Scale watermark in relation to main video
Use the scale2ref filter:
Example to make logo 10% (1/10) the size of the main video: