Apply watermarks
You can add watermarks to videos uploaded using the Stream API.
To add watermarks to your videos, first create a watermark profile. A watermark profile describes the image you would like to be used as a watermark and the position of that image. Once you have a watermark profile, you can use it as an option when uploading videos.
Watermark profile has many customizable options. However, the default parameters generally work for most cases. Please see “Profiles” below for more details.
To create, list, delete, or get information about the profile, you will need your Cloudflare API token ↗.
-
name
string default: empty string- A short description for the profile. For example, “marketing videos.”
-
opacity
float default: 1.0- Translucency of the watermark. 0.0 means completely transparent, and 1.0 means completely opaque. Note that if the watermark is already semi-transparent, setting this to 1.0 will not make it completely opaque.
-
padding
float default: 0.05-
Blank space between the adjacent edges (determined by position) of the video and the watermark. 0.0 means no padding, and 1.0 means padded full video width or length.
-
Stream will make sure that the watermark will be at about the same position across videos with different dimensions.
-
-
scale
float default: 0.15-
The size of the watermark relative to the overall size of the video. This parameter will adapt to horizontal and vertical videos automatically. 0.0 means no scaling (use the size of the watermark as-is), and 1.0 fills the entire video.
-
The algorithm will make sure that the watermark will look about the same size across videos with different dimensions.
-
-
position
string (enum) default: “upperRight”-
Location of the watermark. Valid positions are:
upperRight
,upperLeft
,lowerLeft
,lowerRight
, andcenter
.
-
To upload the image directly, please send a POST request using multipart/form-data
as the content-type and specify the file under the file
key. All other fields are optional.
To specify a URL for upload, please send a POST request using application/json
as the content-type and specify the file location using the url
key. All other fields are optional.
downloadedFrom
will be populated if the profile was created via downloading from URL.
Once you created a watermark profile, you can now use the profile at upload time for watermarking videos.
Unfortunately, Stream does not currently support specifying watermark profile at upload time for Basic Uploads.
The video uploaded with the generated unique one-time URL will be watermarked with the profile specified.
watermark
will be null
if no watermark was specified.
To view a watermark profile that you created:
To list watermark profiles that you created:
To delete a watermark profile that you created:
If the operation was successful, it will return a success response:
- Once the watermark profile is created, you cannot change its parameters. If you need to edit your watermark profile, please delete it and create a new one.
- Once the watermark is applied to a video, you cannot change the watermark without re-uploading the video to apply a different profile.
- Once the watermark is applied to a video, deleting the watermark profile will not also remove the watermark from the video.
- The maximum file size is 2MiB (2097152 bytes), and only PNG files are supported.