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 ?
Examples to overlay/watermark image on video:
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:
Notes
The audio is simply stream copied (remuxed) in this example with
-codec:a copy
instead of being re-encoded. You may have to re-encode depending on your output container format.See the documentation on the
overlay
video filter for more information and examples.See the FFmpeg H.264 Video Encoding Guide for more information on getting a good quality output.
If your image being overlaid is RGB colorspace (such as most PNG images) you may see a visual improvement if you add
format=rbg
to your overlay. Note that if you do this and if you're outputting H.264, then you will have to addformat=yuv420p
(this is another filer–it is different that the similarly named option in the overlay filter). So it may look like this: