Skip to content

Add watermarks to a video with FFmpeg

Adding watermarks to videos is an essential technique for content creators, businesses, and individuals who want to protect their intellectual property or enhance their brand visibility. Whether you're a YouTuber looking to brand your content, a company safeguarding promotional material, or a filmmaker adding production credits, FFmpeg provides powerful tools to add both image and text watermarks to your videos.

LinkWhy add watermarks to videos?

There are several reasons why you might want to add watermarks to your videos:

  1. Brand recognition: Watermarks help viewers instantly recognize your content.
  2. Copyright protection: They deter unauthorized use of your videos.
  3. Professional appearance: Watermarks can add a polished look to your content.
  4. Source attribution: They ensure proper credit when your videos are shared.
  5. Timecoding: For production purposes, you might need to add visible timecodes.

Let's explore how to use FFmpeg to add different types of watermarks to your videos.

LinkTypes of watermarks

There are two main types of watermarks you can add to a video:

  1. Image watermarks: Typically logos or other graphical elements.
  2. Text watermarks: Can be copyright notices, timestamps, or any other textual information.

LinkAdding an image watermark

To add an image watermark to your video, you'll use the overlay filter. Here's a basic command:

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "overlay=10:10" \ output.mp4

Breakdown of the command:

  • -i input_video.mp4: Specifies the input video file
  • -i watermark.png: Specifies the watermark image file
  • -filter_complex "overlay=10:10": Applies the overlay filter, positioning the watermark 10 pixels from the left and top edges
  • output.mp4: Name of the output file

LinkPositioning the watermark

You can adjust the position of the watermark using different overlay options:

Bottom right corner

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4

Center of the video

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" output.mp4

LinkAdding a text watermark

To add a text watermark, you'll use the drawtext filter. This is particularly useful for adding copyright notices or timestamps. Here's a basic command:

bash
ffmpeg -i input_video.mp4 \ -vf "drawtext=text='Copyright 2024':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=h-th-10" \ output.mp4

This command adds a copyright notice at the bottom center of the video with a semi-transparent background box.

LinkCustomizing text watermarks

You can customize various aspects of the text watermark:

Changing font

bash
ffmpeg -i input_video.mp4 \ -vf "drawtext=fontfile=/path/to/font.ttf:text='My Watermark':fontcolor=white:fontsize=24:x=10:y=10" \ output.mp4

Adding a timestamp

bash
ffmpeg -i input_video.mp4 \ -vf "drawtext=text='%{pts\:hms}':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=10" \ output.mp4

LinkAdvanced techniques

LinkAdding both image and text watermarks

You can combine both image and text watermarks for more comprehensive branding:

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "[0:v][1:v]overlay=10:10[bg];[bg]drawtext=text='Copyright 2024':fontcolor=white:fontsize=24:x=(w-text_w)/2:y=h-th-10[out]" \ -map "[out]" -map 0:a \ output.mp4

LinkAdjusting watermark opacity

To make the watermark semi-transparent, which can be less intrusive on the video content:

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "overlay=10:10:alpha=0.5" \ output.mp4

LinkAnimating the watermark

For a more dynamic effect, you can create a moving watermark:

bash
ffmpeg -i input_video.mp4 \ -i watermark.png \ -filter_complex "overlay='if(gte(t,1), -w+(t-1)*200, NAN)':10" \ output.mp4

This makes the watermark enter from the left side after 1 second, which can be attention-grabbing without being overly distracting.

LinkChoosing between image and text watermarks

Both image and text watermarks have their benefits and drawbacks:

LinkImage watermarks

Benefits

  • Can include complex logos or designs
  • Often more visually appealing
  • Better for brand recognition

Drawbacks

  • May be more intrusive on the video content
  • Can be more easily removed by cropping

LinkText watermarks

Benefits

  • Can convey specific information (e.g., copyright notices)
  • Generally less intrusive
  • Easier to make semi-transparent

Drawbacks

  • Limited in design complexity
  • May not be as effective for brand recognition

LinkTips for adding effective watermarks

  1. Choose appropriate size: Ensure your watermark is visible but not distracting. The goal is to protect your content without diminishing the viewer's experience.
  2. Consider video content: Place the watermark where it won't interfere with important parts of your video. This might mean adjusting the position for different types of content.
  3. Test different opacities: Find a balance between visibility and unobtrusiveness. A semi-transparent watermark can be effective without being too distracting.
  4. Be mindful of compression: Some video compression methods may affect the quality of your watermark, especially text. Always test your output on different devices and platforms.
  5. Respect copyright: Ensure you have the right to use any logos or fonts in your watermarks. This is particularly important for commercial use.
  6. Consistency is key: If you're watermarking multiple videos, try to maintain a consistent style and position. This helps with brand recognition across your content.
  7. Consider the platform: Different video platforms may have specific requirements or best practices for watermarks. Adjust your approach accordingly.

LinkConclusion

By using the techniques outlined in this guide, you can effectively brand and protect your video content while maintaining its visual appeal. Remember to always test your watermarked videos on various devices and platforms to ensure the best possible viewer experience.

As you become more comfortable with FFmpeg's watermarking capabilities, you can experiment with more complex effects and combinations to create watermarks that perfectly suit your needs and enhance your video content.

LinkApplying watermarks with Mux

If you have videos hosted with the Mux Video API you can apply image watermarks with the watermark API.

No credit card required to start using Mux.