Video overlay / watermark examples:
centered

ffmpeg -i input.mp4 -i logo.png -filter_complex \ "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" \ -codec:a copy output.mp4
or with reduced overlay options:
overlay=(Ww)/2:(Hh)/2
Top left
This is not easy, because by default, if you do not provide any options for overlaying, you need to place the image in the upper left corner.
This example adds 5 pixels of padding, so the image does not touch the edges:
overlay=5:5
In the upper right corner
With 5 fill pixels:
overlay=main_w-overlay_w-5:5
or with abbreviated parameters:
overlay=Ww-5:5
Bottom right
With 5 fill pixels:
overlay=main_w-overlay_w-5:main_h-overlay_h-5
or with abbreviated parameters:
overlay=Ww-5:Hh-5
Bottom left
With 5 fill pixels:
overlay=5:main_h-overlay_h
or with abbreviated parameters:
overlay=5:Hh-5
Notes
The sound is simply stream copied (remixed) in this example with -codec:a copy instead of re-encoding. You may need to transcode depending on the format of your output container.
See the overlay documentation for more details and examples.
For more information on getting good quality, see the FFmpeg H.264 Video Encoding Guide .
If your image overlays, it is an RGB color space (for example, most PNG images), you can see the visual improvement by adding format=rbg to your overlay. Please note that if you do this and if you output H.264, you will need to add format=yuv420p (this is another file filter - another that is similarly named parameter in the overlay filter). It might look like this:
overlay=5:Hh-5:format=rgb,format=yuv420p
LordNeckbeard Jun 06 '12 at 19:29 2012-06-06 19:29
source share