How to add transparent watermark in center of a video with ffmpeg? -
i 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 place watermark center of video ?
examples overlay/watermark image on video:
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 shortened overlay options:
overlay=(w-w)/2:(h-h)/2
top left
this easy 1 because default, if provide no options overlay, place image in top left.
this example adds 5 pixels of padding image not touching edges:
overlay=5:5
top right
with 5 pixels of padding:
overlay=main_w-overlay_w-5:5
or shortened options:
overlay=w-w-5:5
bottom right
with 5 pixels of padding:
overlay=main_w-overlay_w-5:main_h-overlay_h-5
or shortened options:
overlay=w-w-5:h-h-5
bottom left
with 5 pixels of padding:
overlay=5:main_h-overlay_h
or shortened options:
overlay=5:h-h-5
notes
the audio stream copied (remuxed) in example
-codec:a copy
instead of being re-encoded. may have re-encode depending on output container format.see documentation on
overlay
video filter more information , examples.see ffmpeg h.264 video encoding guide more information on getting quality output.
if image being overlaid rgb colorspace (such png images) may see visual improvement if add
format=rbg
overlay. note if and if you're outputting h.264, have addformat=yuv420p
(this filer–it different named option in overlay filter). may this:overlay=5:h-h-5:format=rgb,format=yuv420p
Comments
Post a Comment