The command:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]" outputvideo.flv
produces the video with the image "watermarklogo.png" in the top left hand corner. Calling this command from another program should be simple enough.
Breaking this down bit by bit to understand it:
ffmpeg
is the program you'll be using to add the watermark.
-i
is used to specify the input files.
inputvideo.avi
is your input file specified by -i
.
-vf
is used to specify the video filter. In this case, this is everything in the quotes.
movie=watermarklogo.png
will load the file you want to use as the watermark. Here we load the file as a video source (by using movie
) regardless of whether or not the file is an video. In this case it is an image.
[watermark]
labels the file you just loaded. This label will be used in the rest of the code.
[in]
and [out]
refer to the input stream and the output stream of the video.
overlay
is used right after the [watermark]
label so that it refers to it. In this simple case we place the overlay
at 10:10
. This means the watermark will be offset by 10 pixels from the top and from the left. If you wanted bottom right you would use overlay=main_w-overlay_w-10:main_h-overlay_h-10
where main_w
is the input stream's width, overlay_h
is the height of the overlay file, and so on.
Lastly, outputvideo.flv
is clearly the file you wish to save the results to.
Additional information:
I found this information through the site Dmitry had mentioned in the comments. Alex had mentioned that this page might be too complex for someone who's new to such things. However, I've never done anything like this and within just a couple minutes I had the results I believe are being sought.
Note: I had a moment of trouble when I was getting the error:
error while opening encoder for output stream #0.1
If you have the same problem you likely need to manually set the sampling frequency using the -ar parameter (e.g. -ar 22050).