Watermarking a video with ffmpeg is simple – at least once you have the correct command line. Here is what I’ve figured out:
ffmpeg -y -i ‘inputFile.mpg’ -vhook ‘/usr/lib/vhook/watermark.so -f /home/user/VideoTag.gif’ …
I am using the older “-vhook” (video hook) functionality of ffmpeg here. Please be carful with the location of the watermark.so library. Depending on your system, version of the library, etc. the location may differ. Look for it in either “/usr/lib/vhook/watermark.so” or “/usr/local/lib/vhook/watermark.so”!
Watermarking with the new libavfilter based ffmpegs
If you want to find out how to do a watermark with the new lib AV Filter interface of ffmpeg, then information is relatively sparse on the Internet, thus here is an example command and the link to the official docs to get you started:
ffmpeg -i somevideo.avi -vf ‘movie=logo.png, scale=320:-1 [logo];[in][logo] overlay=0:H-h [out]‘ -deinterlace -f flv -ar 22050 -ab 96000 -ac 2 -r 25 -b:v 400000 -g 50 output.flv
This here transcodes an avi file into flv while embedding a logo watermark. -vf means “video filter“, some ffmpeg versions require the -vfilter option instead. The -vf syntax is more or less: you define elements and then what to do with them. Here we define a png image as input “movie”, then we scale it to 320 and -1 means ‘whatever the second value is to keep aspect ratio’, and after the semicolon we combine the default [in] movie with the scaled [logo] via the overlay filter, and some positioning. (Also note the new bitrate switch -b:v which means “bitrate-video”.)
Read about the full ffmpeg libavfilter syntax here.