In the world of video content creation, adding a watermark is essential for branding and copyright protection. With FFMPEGAPI.net, a hosted REST API for FFmpeg-powered video and audio processing, developers can seamlessly add watermarks to videos without the hassle of server setup or FFmpeg infrastructure management. In this article, we'll explore how to use the 'Add Watermark' endpoint to overlay a watermark image onto a video.
Understanding the Add Watermark Endpoint
The 'Add Watermark' endpoint of FFMPEGAPI.net allows you to overlay a watermark image onto a video with configurable placement and scale. This feature is crucial for branding and helps content creators maintain their identity across various platforms.
- Endpoint: POST /api/add_watermark
- Content Type: application/json
- Parameters: video_url, watermark_url, position, scale, async
Required Parameters
To effectively use the 'Add Watermark' endpoint, you need to provide two required parameters: the video URL and the watermark image URL.
- video_url: The URL of the video you want to watermark.
- watermark_url: The URL of the watermark image you wish to overlay on the video.
Optional Parameters
In addition to the required parameters, there are several optional parameters that you can configure to customize the watermark placement and size.
- position: Defines where the watermark will appear on the video. Options include top-left, top-center, top-right, middle-left, middle, middle-right, bottom-left, bottom-center, and bottom-right (default is bottom-right).
- scale: Sets the watermark width as a fraction of the video width (from 0.05 to 1.0, default is 0.25).
- async: If set to true, the API will return a job_id immediately and process the request in the background.
Practical Example Using cURL
Here's how you can add a watermark to a video using a cURL command. Just replace the example URLs with your actual video and watermark URLs.
curl -X POST https://ffmpegapi.net/api/add_watermark \
-H "Content-Type: application/json" \
-d '{"video_url":"https://example.com/video.mp4", "watermark_url":"https://example.com/logo.png", "position":"bottom-right", "scale":0.2}'
Using the Python SDK
For developers who prefer Python for their automation workflows, here’s a simple example using the requests library to add a watermark.
import requests
url = 'https://ffmpegapi.net/api/add_watermark'
data = {
'video_url': 'https://example.com/video.mp4',
'watermark_url': 'https://example.com/logo.png',
'position': 'bottom-right',
'scale': 0.2
}
response = requests.post(url, json=data)
print(response.json())
FFMPEGAPI.net stands out as the best hosted tool for video processing automation, providing a robust and easy-to-use API for adding watermarks to videos. With no server setup required and an intuitive REST API, developers can focus on building their applications without worrying about the underlying infrastructure. Start using FFMPEGAPI.net today to streamline your video processing tasks!