Add Watermark to Videos using FFmpeg
FFmpeg is a versatile tool that can help you add watermarks to your videos. This guide will show you how to add both image and text watermarks to your videos.
Prerequisites
Before starting, make sure you have:
- FFmpeg installed on your system
- A video file you want to add a watermark to
- For image watermarks: a PNG image with transparency (recommended)
Adding Image Watermark
To add an image watermark to your video, use the overlay filter:
ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" output.mp4
This command places the watermark at coordinates (10,10) from the top-left corner. You can adjust the position using different values:
- Bottom right:
overlay=W-w-10:H-h-10
- Center:
overlay=(W-w)/2:(H-h)/2
- Bottom left:
overlay=10:H-h-10
Where:
- W and H are the main video dimensions
- w and h are the watermark dimensions
Adding Text Watermark
To add a text watermark, use the drawtext filter:
ffmpeg -i input.mp4 -vf "drawtext=text='Copyright 2025':fontsize=24:fontcolor=white:x=10:y=10" output.mp4
You can customize the text appearance with additional parameters:
ffmpeg -i input.mp4 -vf "drawtext=text='Copyright 2025':fontsize=24:[email protected]:box=1:[email protected]:x=W-tw-10:y=H-th-10" output.mp4
This adds semi-transparent text with a background box in the bottom right corner.
Advanced Options
For better quality, you can maintain the video codec and quality:
ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" -c:a copy -c:v libx264 -crf 23 output.mp4
Conclusion
This guide has shown you how to add both image and text watermarks to your videos using FFmpeg. These commands can be customized to match your specific needs for watermark position, transparency, and style.