How to do a text watermark in FFmpeg

I wanted a way to avoid using an image to watermark videos with FFmpeg. Sometimes just simple text is great in watermarking media. Here is how to do it with some examples:

Using FFmpeg Drawtext we can create text and add a shadow in the chosen location. This example the watermark will be in the bottom left:

ffmpeg -i "input.mp4" -vf "drawtext=text='a watermark':x=10:y=H-th-10:fontfile=/pathto/font.ttf:fontsize=10:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=2" "output.mp4"

The watermark will also have a shadow that makes the watermark standout more. Keep in mind you must have a font file (.ttf) to do this. Make sure you edit the path to it in the command supplied above.

As for the location of the watermark, that is defined by x and y. In the example the text will be padded 10 from the left and up 10 from the bottom of the video. To do bottom right make it: x=-10:y=H-th-10