Creates a watermark template.
Usage notes
After you create a watermark template by calling this operation, you can specify the watermark template and watermark asset when you submit a transcoding job. This allows you to add watermark information to the output video.
QPS limit
You can call this API operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation. For more information, see QPS limit.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | AddWaterMarkTemplate |
The operation that you want to perform. Set the value to AddWaterMarkTemplate. |
Name | String | Yes | example-watermark-**** |
The name of the watermark template. The value can contain letters and digits and can be up to 128 bytes in size. |
Config | String | Yes | {"Width":"10","Height":"30","Dx":"10","Dy":"5","ReferPos":"TopRight","Type":"Image","Timeline":{"Start":"0","Duration":"10"}} |
The configuration of the watermark template. The value is a JSON object. For more information, see Watermark templates. Note If you do not require a positive correlation between the size of text in the watermark
and the resolution, you can enable adaptation for the watermark. To do so, add
['adaptive']=true to the text parameter of the watermark.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
WaterMarkTemplate | Object |
The details of the watermark template. |
|
Type | String | Image |
The type of the watermark. Valid values:
|
RatioRefer | Object |
The values of the Height, Width, Dx, and Dy parameters relative to the reference edges. If the values of the Height, Width, Dx, and Dy parameters are decimals between 0 and 1, the values are calculated by referring to the following edges in sequence:
|
|
Dx | String | 0.51 |
The horizontal offset of the watermark relative to the output video image. Default value: 0. The default value indicates no offset. The value can be an integer or a decimal.
|
Width | String | 0.36 |
The width of the watermark image in the output video. The value can be an integer or a decimal.
|
Height | String | 0.33 |
The height of the watermark image in the output video. The value can be an integer or a decimal.
|
Dy | String | 0.28 |
The vertical offset of the watermark relative to the output video image. Default value: 0. The default value indicates no offset. The value can be an integer or a decimal.
|
ReferPos | String | TopRight |
The position of the watermark. Valid values:
|
State | String | Normal |
The status of the watermark template. Valid values:
|
Dx | String | 10 |
The horizontal offset. Unit: pixel. |
Width | String | 10 |
The width of the watermark image. Unit: pixel. |
Height | String | 30 |
The height of the watermark image. Unit: pixel. |
Timeline | Object |
The timeline of the watermark. |
|
Start | String | 0 |
The beginning of the time range during which the watermark is displayed.
|
Duration | String | ToEND |
The display duration of the watermark. Default value: ToEND. The default value indicates that the watermark is displayed until the video ends. |
Name | String | example-watermark-**** |
The name of the watermark template. |
Dy | String | 5 |
The vertical offset. Unit: pixel. |
Id | String | 3780bd69b2b74540bc7b1096f564**** |
The ID of the watermark template. We recommend that you keep this ID for subsequent operation calls. |
RequestId | String | 54BB917F-DD35-4F32-BABA-E60E31B21W63 |
The ID of the request. |
Examples
Sample requests
http(s)://mts.cn-shanghai.aliyuncs.com/?Action=AddWaterMarkTemplate
&Name=example-watermark-****
&Config={"Width":"10","Height":"30","Dx":"10","Dy":"5","ReferPos":"TopRight","Type":"Image","Timeline":{"Start":"0","Duration":"10"}}
&<Common request parameters>
Sample success response
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<AddWaterMarkTemplateResponse>
<WaterMarkTemplate>
<Type>Image</Type>
<RatioRefer>
<Dx>0.51</Dx>
<Width>0.36</Width>
<Height>0.33</Height>
<Dy>0.28</Dy>
</RatioRefer>
<ReferPos>TopRight</ReferPos>
<State>Normal</State>
<Dx>10</Dx>
<Width>10</Width>
<Height>30</Height>
<Timeline>
<Start>0</Start>
<Duration>ToEND</Duration>
</Timeline>
<Name>example-watermark-****</Name>
<Dy>5</Dy>
<Id>3780bd69b2b74540bc7b1096f564****</Id>
</WaterMarkTemplate>
<RequestId>54BB917F-DD35-4F32-BABA-E60E31B21W63</RequestId>
</AddWaterMarkTemplateResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"WaterMarkTemplate" : {
"Type" : "Image",
"RatioRefer" : {
"Dx" : "0.51",
"Width" : "0.36",
"Height" : "0.33",
"Dy" : "0.28"
},
"ReferPos" : "TopRight",
"State" : "Normal",
"Dx" : "10",
"Width" : "10",
"Height" : "30",
"Timeline" : {
"Start" : "0",
"Duration" : "ToEND"
},
"Name" : "example-watermark-****",
"Dy" : "5",
"Id" : "3780bd69b2b74540bc7b1096f564****"
},
"RequestId" : "54BB917F-DD35-4F32-BABA-E60E31B21W63"
}
Error codes
For a list of error codes, visit the Error Center.