Adding watermarks or image overlay to videos using API

October 4, 2024
10 Min
Video Engineering
Jump to
Share
This is some text inside of a div block.

Adding watermarks to videos is a common practice used for branding, copyright protection, and enhancing visual appeal. As the demand for video content grows across various platforms, the need for efficient and automated solutions has become increasingly important. Using APIs to streamline the watermarking process not only simplifies implementation but also ensures consistency and quality in video presentation. This approach allows content creators to protect their intellectual property while reinforcing brand identity, all with minimal effort. Before we get into the technical steps, it's important to understand the two primary types of watermarks perceptible and imperceptible and their distinct benefits.

What is watermark?

What is watermarking and why to add them to videos?

Video watermarking is the process of embedding a unique identifier into a video file. This identifier can be visible (perceptible) or invisible (imperceptible) mar to viewers. The primary goals of watermarking are to assert copyright ownership, deter piracy, and track the distribution of video content.

Watermarks can carry various types of information, including:

  • Copyright Information: Identifying the owner of the content.
  • User Information: Embedding user IDs or device IDs to trace unauthorized sharing.
  • Time Stamps: Indicating when the content was accessed or viewed.

Types of video watermarking

Video watermarking techniques can be broadly categorized into two types: perceptible and imperceptible.

Perceptible watermarking:

  • This method involves superimposing a logo or text over the video content. While it is easily visible, it may not effectively deter piracy since it can be removed or obscured by internet pirates.
  • Commonly used in promotional videos or broadcasts, perceptible watermarks serve as a branding tool but do not provide protection against unauthorized distribution.‍

Imperceptible watermarking:

  • Imperceptible watermarks are embedded within the video data in such a way that they are not noticeable to viewers. This type of watermarking is more effective for copyright protection.
  • These watermarks can embed metadata such as user IDs, timestamps, and device information, which can be used as forensic evidence to trace leaks or unauthorized streams.
how does watermarking works

Common challenges in video watermarking

While video watermarking provides significant benefits, it also faces several challenges:

  • Security against attacks: Watermarked videos can undergo various forms of attacks such as compression, cropping, or filtering. A watermark should remain detectable even after these modifications.
  • Latency issues: Some watermarking techniques may introduce latency during processing, which can be problematic for live streaming applications where real-time performance is crucial.
  • Quality degradation: Maintaining high visual quality while embedding watermarks is essential. Poorly implemented watermarking can lead to noticeable artifacts in the video.
  • Scalability: As streaming services grow and serve millions of users simultaneously, watermarking solutions must scale effectively without compromising performance or quality.

Real use cases of using video watermarking

Content protection

Streaming services utilize watermarking to protect their original content from piracy and unauthorized distribution.

Example: Netflix and Hulu employ advanced watermarking techniques to safeguard their exclusive shows and movies. For instance, Netflix uses forensic watermarking to embed unique identifiers into its streams. This allows them to trace the source of any leaked content back to the specific user account, thereby deterring piracy and ensuring that their intellectual property is protected.

Broadcast monitoring

Television networks use watermarking to track their broadcasts and ensure compliance with licensing agreements.

Example: BBC and other major broadcasters often embed watermarks in their programming to monitor where their content is aired. For example, during the Olympics, broadcasters use watermarked feeds to verify that their coverage is compliant with broadcasting rights agreements. This helps them track unauthorized broadcasts and enforce licensing terms effectively.

Advertising

Advertisers incorporate perceptible watermarks in promotional videos to enhance brand visibility while ensuring that their content is attributed correctly.

Example: During high-profile events like the Super Bowl, advertisers often use visible watermarks or logos in their commercials. For example, a company like Coca-Cola may include its logo prominently in ads aired during the event. This not only reinforces brand recognition but also ensures that viewers associate the advertisement with Coca-Cola, even if it gets shared on social media platforms.

  • Enhanced copyright protection: By embedding identifying information within videos, content owners can assert their rights and deter unauthorized use effectively.
  • Real-time monitoring: With dynamic adaptation capabilities, modern watermarking solutions can respond quickly to threats in real-time streaming scenarios, allowing for swift action against piracy.
  • Improved user engagement: By using perceptible watermarks strategically in promotional materials, brands can increase recognition and engagement with their audience.
  • Cost-effective security solution: Compared to other security measures like encryption or DRM (Digital Rights Management), watermarking is often more cost-effective while still providing substantial protection against piracy.
  • Future-proof technology: As technology evolves, many modern watermarking solutions are designed to be deployable across various platforms and devices, ensuring long-term usability.

How APIs make video watermarking simpler

Implementing video watermarking can be complex, but APIs simplify this process by providing a streamlined solution for developers. Here are a few key benefits:

  1. Pre-Built Infrastructure: APIs handle the complex operations involved in watermarking, such as encoding and rendering, in the cloud. This eliminates the need for developers to set up and manage their own infrastructure.

    Example: Using FastPix, developers can easily watermark a video by sending a request with the video URL and watermark details, without needing to manage servers or processing.
  1. Ease of Integration : APIs offer ready-to-use endpoints and comprehensive documentation, allowing for quick integration into applications. This means developers can implement watermarking functionality with minimal effort.
  2. Fast Implementation: A few lines of code can add watermarking features, enabling rapid development and deployment of video content.

Save Time with Video Search

Know more

Adding video watermark using FastPix API

FastPix provides API for video processing, including features for adding watermarks or image overlays to videos. You can add watermarks during media creation, which applies to both uploaded videos.

Key features for users

  • Multiple Watermarks: You can add more than one watermark to a video.
  • Customizable Overlay Settings: Control the position, size, and opacity of your watermark.

Supported storage types:

The URL can originate from various cloud storage services or content delivery networks (CDNs) such as:

Amazon S3: URLs from Amazon's Simple Storage Service.

Google Cloud Storage: URLs from Google Cloud's storage solution.

Azure Blob Storage: URLs from Microsoft's Azure storage.

Public CDNs: URLs from public content delivery networks that host video files.

Or any URL that the public can access.

Getting started with FastPix

Create an account and get your API key

First, sign up for a FastPix account at dashboard.fastpix.io Once registered, navigate to your account settings to find your API keys. You will need these keys to authenticate your requests.

Upload your video

Before adding a watermark, you need to upload the video you want to watermark. This can be done using the FastPix API's Create media from URL creation endpoint.

POST https://v1.fastpix.io/on-demand

This endpoint allows developers or users to create a new video or audio media in FastPix using a publicly accessible URL. FastPix will fetch the media from the provided URL, process it, and store it on the platform for use.

Example cURL request for uploading a video:

1curl -X POST 'https://v1.fastpix.io/on-demand' \
2   --user {Access Token ID}:{Secret Key} \
3   -H 'Content-Type: application/json' \
4   -d '{
5   "inputs": [
6      {
7         "type": "video",
8         "url": "https://static.fastpix.io/sample.mp4",
9         "startTime": 0,
10         "endTime": 60
11      },
12      {
13         "type": "watermark",
14         "url": "https://static.fastpix.io/watermark-4k.png",
15         "placement": {
16            "xAlign": "left",
17            "xMargin": "10%",
18            "yAlign": "top",
19            "yMargin": "10%"
20         }
21      }
22   ],
23"metadata": {
24      "key1": "value1"
25   },
26"accessPolicy": "public",
27   "maxResolution": "1080p"
28}

This request uploads your video and returns an asset ID that you will use in subsequent requests.

Add watermark to your video

Once your video is uploaded, you can add a watermark using the overlay settings in your media creation request. The first input in your array should be the video file URL, followed by the URL of your watermark image along with its placement details.

Request Example:

1{  
2
3  "inputs": [  
4
5  {  
6    "type": "video",  
7    "url": " {VIDEO_INPUT_URL}”,  
8    "startTime": 0,  
9    "endTime": 60  
10  },  
11
12  {  
13  "type": "watermark",  
14  "url": " {IMAGE _INPUT_URL} ",  
15  "placement": {  
16    "xAlign": "top",  
17    "xMargin": "10%",  
18    "yAlign": "left",  
19    "yMargin": "10%"  
20  },  
21  "width": "25%",  
22  "height": "25%",  
23  "opacity": "80%"  
24
25  } 
26  ] , 
27
28  "accessPolicy": "public", 
29  “maxResolution”: “1080p” 
30
31}

Explanation:

XAlign : Displays the vertical positioning of the watermark.  

XMargin: The horizontal distance between the starting point of vertical alignment and the closest edge of the image/video  

YAlign: Displays the horizontal positioning of the watermark  

YMargin: The vertical distance between the starting point of vertical alignment and the closest edge of the image/video.

Testing and finalizing your watermarked video

After sending your request with overlay settings:

  1. Wait for processing time as FastPix prepares your watermarked video.
  2. Retrieve playback URLs from the response to view or share your newly created watermarked video.

Conclusion

Video watermarking is an essential tool for protecting digital content in an era where piracy poses significant challenges for creators and distributors alike. By understanding the different techniques available ranging from perceptible to imperceptible methods content owners can choose appropriate strategies that align with their specific needs for security and branding.

Adding watermarks to videos using the FastPix API is a straightforward process that enhances branding and protects content from unauthorized use. By leveraging customizable overlay settings, you can ensure that your videos not only look professional but also serve their intended purpose effectively.

Try for Free

Enjoyed reading? You might also like

Try FastPix today!

FastPix grows with you – from startups to growth stage and beyond.