Login

Watermark your videos

Watermarking is a key step for content creators, enabling you to protect your intellectual property, enforce copyright, and enhance brand recognition across your videos. With the FastPix API, you can seamlessly apply visible watermarks to videos to ensure your content remains secure and identifiable. This guide provides a step-by-step walkthrough to help you implement watermarking effectively.



Prerequisites

Before you can add watermarks to videos, make sure you have the following:


  • Access to the FastPix media upload API: You'll need the API key and permissions set up.
  • The URL of the video to watermark: This will be the video source where the watermark will be applied.
  • A watermark image URL: The image you want to overlay on the video (usually a logo or a branded graphic). Ensure the image is optimized for overlaying with transparent backgrounds if needed.

Step-by-step guide to add watermark

To apply a watermark to your video using the FastPix API, you’ll need to structure your API request with a payload that defines the video and watermark inputs, along with properties for placement, size, and opacity. The watermark parameters allow you to customize the positioning and appearance based on your branding needs


  1. Define the video and watermark in inputs: The inputs array specifies the video as the first element and the watermark image as the second.
  2. Set placement and styling parameters: Control the placement of the watermark using alignment and margin settings, and adjust the watermark’s appearance with size and opacity settings.
  3. Specify access policy and resolution: Define access settings for the video and the maximum resolution to maintain quality.

{
    "inputs": [
        {
            "type": "video",
            "url": " {VIDEO_INPUT_URL}”,
            "startTime": 0,
            "endTime": 60
        },
        {
            "type": "watermark",
            "url": " {IMAGE _INPUT_URL} ",
            "placement": {
                "xAlign": "top",
                "xMargin": "10%",
                "yAlign": "left",
                "yMargin": "10%"
            },

            "width": "25%",
            "height": "25%",
            "opacity": "80%"
        }
    ]
    "accessPolicy": "public", 
        “maxResolution”: “1080p”
}

Key parameters for watermark placement

Here’s a breakdown of each parameter that controls the watermark’s appearance and positioning:


Placement options

xAlign: Aligns the watermark horizontally within the video. Options are:

  • left: Positions watermark at the far-left side.
  • center: Centers the watermark horizontally.
  • right: Positions watermark at the far-right side.

yAlign: Aligns the watermark vertically within the video. Options are:

  • top: Places the watermark at the top edge.
  • middle: Centers the watermark vertically.
  • bottom: Positions the watermark at the bottom edge.

📘

TIP

Setting both xAlign to center and yAlign to middle will place the water precisely at the center of the video.


Margin settings

xMargin: Controls the horizontal margin of the watermark image from the top left corner. You can specify values in:

  • Pixels (e.g., 20px): Provides exact pixel placement.
  • Percentage of video width (e.g., 10%): Scales the margin based on video width, which is ideal for adaptable placements across varying resolutions.

yMargin: Controls the vertical margin of the watermark image from the top left corner. Accepts the following:

  • Pixels (e.g., 20px): For precise, fixed positioning.
  • Percentage of video height (e.g., 10%): Scales the margin based on video height, helpful for proportional positioning across resolutions.

Size and appearance

width and height: Set the dimensions of the watermark. You can specify:

  • Pixels (e.g., 80px): For exact sizing.
  • Percentage (e.g., 10%): Scales based on video dimensions, maintaining proportionality.

opacity: Controls the transparency level, where:

  • 100% is fully opaque, and 0% is fully transparent.
  • Example: opacity: 80% creates a semi-transparent effect, which can help blend the watermark with the video’s content.

Positioning watermarks using percentages and pixels

Watermarks can be positioned using either percentages or pixels. Understanding the difference is important for consistent placement across different video resolutions.


Using percentages

Percentage-based positioning is relative to video dimensions, allowing the watermark to automatically scale with different video resolutions. This is particularly useful for videos that may be viewed on screens of varying sizes.

  • Example Calculation: Setting xMargin: 10% on a 1920-pixel wide video places the watermark 192 pixels from the left edge. If the video scales down, this margin adjusts proportionally.

Example payload (percentage-based positioning)

{
    "inputs": [
        {
            "type": "video",
            "url": " {VIDEO_INPUT_URL}”,  
            "startTime": 0,
            "endTime": 60
        },
        {
            "type": "watermark",
            "url": " {IMAGE _INPUT_URL} ",
            "placement": {
                "xAlign": "top",
                "xMargin": "10%",
                "yAlign": "left",
                "yMargin": "10%"
            },
            "width": "10%",
            "height": "10%",
            "opacity": "80%"
        }
    ],
        "accessPolicy": "public",      
    “maxResolution”: “1080p”
} 

Using pixels

Pixel-based positioning provides precise control over the watermark’s placement, ideal for fixed-size videos where exact positioning is necessary. However, pixel values do not automatically adapt to different resolutions, so the watermark may appear differently if the video is resized.


📘

PLEASE NOTE

Pixel-based positioning may result in inconsistent placement on different screen sizes or resolutions, so it is best used when precise margins are required.


Example payload (pixel-based positioning)

{
    "inputs": [
        {
            "type": "video",
            "url": " {VIDEO_INPUT_URL}”,  
            "startTime": 0,
            "endTime": 60
        },
        {
            "type": "watermark",
            "url": " {IMAGE _INPUT_URL} ",
            "placement": {
                "xAlign": "top",
                "xMargin": "40px",
                "yAlign": "left",
                "yMargin": "40px"
            },
            "width": "80px"
        }
    ],
    "accessPolicy": "public", 
    “maxResolution”: “1080p”
}

Pros & cons of percentage vs. pixel positioning

Percentage-based positioning:

  • Pros: Adapts to the video size and scales automatically, making it more versatile for multi-resolution environments.
  • Cons: May lack precise control for exact positioning, which can be an issue for fixed designs.

Pixel-based positioning:

  • Pros: Offers exact positioning, ensuring the watermark appears in the same spot for each frame.
  • Cons: May not adapt well to different video resolutions, leading to inconsistent results on screens of varying sizes.

📘

DEVELOPMENT TIP

Use percentage-based positioning if you expect videos to be viewed on a range of screen size; use pixel-based for fixed environments or controlled resolutions.


Centering a watermark

Centering the watermark can be a useful choice, particularly for branding logos or overlay information that needs equal prominence.

  • Set xAlign to "center" and yAlign to "middle" in the watermark payload. This will position the watermark in the exact center of the video.

Example payload (center-aligned positioning)

{
    "input": [
        {
            "url": "{VIDEO_INPUT_URL}"
        },
        {
            "type": "watermark ",
            "url": "{IMAGE _INPUT_URL}",
            "placement": {
                "xAlign": "middle",
                "yAlign": "center"
            }  
    ],  
    “accessPolicy”: "public", 
    “maxResolution”: “1080p”
}


Example use cases and best practices


Adding a brand logo

Position your logo at a consistent corner (e.g., top-left with xMargin: 10% and yMargin: 10%) to establish brand presence while keeping the primary content clear.


Adding watermarks for copyright protection

For copyright marks, consider using a low-opacity watermark across the center, which is more difficult to remove or crop out.


📘

TIP

Lower opacity values (e.g., 50%) are recommended for unobtrusive yet effective copyright marking.


Using watermarks for temporary event branding

If watermarking videos for a specific event or campaign, you can adapt placement and size dynamically with percentages to maintain a cohesive look across various screen types and resolutions.