Watermarking is the process of placing an image, text, or logo on top of a video. There are several reasons to use this technique, including making videos according to a brand style, adding titles and overlaying visual elements over existing videos. To watermark videos using an API, send the following API request:
curl -s -X POST https://api.creatomate.com/v1/renders \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data-binary @- << EOF
{
"source": {
"output_format": "mp4",
"elements": [
{
"type": "video",
"source": "https://cdn.creatomate.com/demo/mountains.mp4"
},
{
"type": "image",
"source": "https://cdn.creatomate.com/demo/logo.png",
"x": "100%",
"y": "0%",
"width": "60 vmin",
"height": "60 vmin",
"x_padding": "7 vmin",
"y_padding": "7 vmin",
"x_anchor": "100%",
"y_anchor": "0%",
"x_alignment": "100%",
"y_alignment": "0%",
"shadow_color": "rgba(0,0,0,0.66)",
"fit": "contain"
}
]
}
}
EOF
How it works: This example uses cURL to invoke the Creatomate video editing API. The REST API works by defining a video composition in JSON format. The API will then perform the operation in the cloud and return the watermarked video.
In this example, the video composition is comprised of two elements: a background video and a logo that appears above the background video. You can host the input files at any publicly accessible URL.
The watermark image, in this example a logo, is located in the top-right corner of the video. To accomplish this, we need to specify the "x" and "y" properties along with the "x_anchor" and "y_anchor" properties. And using the "padding" property, we can give some space between the logo and video edges.
As you can see, all properties are defined in terms of relative units, like "vmin" and "%". As a result, the watermark adjusts dynamically based on the background video's format, which allows it to be responsive and compatible with any resolution, such as horizontal, vertical, or square video.
This is just one example of how to use Creatomate's video API. If you want to create more advanced video compositions, you can use the video editor. This online tool allows you to create your own templates that can then be exported as JSON to be used in your API automation workflows.