post https://s2-api.safestream.com/2.0/templates
Create reusable and dynamic watermark settings
The idea behind watermark templates is that you can keep the layout and style of the watermark consistent while making the content dynamic. Templates support placeholders. So, you can define variables that will be replaced with values at watermark time.
The following is a simple example that shows what a template could look like supporting a dynamic name:
{
"name": "my-example-watermark-temaplte",
"settings": [
{
"content": "{name}"
}
]
}
Template Options
This section provides example settings and templates that can be used to meet most common watermarking scenarios. The SafeStream template API provides many customization options that allow you to go beyond the templates listed here.
Property Name | Required | Example | Description |
---|---|---|---|
name | Yes | My Template | The name of the template. This should be unique per account. |
description | No | This is a description of my template | A description of the template. |
settings | Yes | An array of Objects describing the watermarks on the template. | The watermark settings. |
Settings is an array of objects, where each object matches the following description.
Property Name | Required | Example | Description |
---|---|---|---|
content | Yes | User Name: [%firstName%] [%lastName%] | Plain text, such as a users' name or email address |
fontColor | No | 0xFFFFFF | The hexadecimal color value for the content |
fontOpacity | No | 0.5 | 0xFFFFFF |
fontSize | No | 0.5 | Value between 0 and 1. The ensure that watermark text is place within the frame of the video, the font size is relative to the width of the video. For most videos a font size between 0.05 and 0.15 is reasonable. |
x | No | 0.5 | Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video. |
y | No | 0.5 | Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video. |
align | No | CENTER LEFT RIGHT | Relative horizontal position of the text. The position is relative to the size of the video. So, an x value of 0.5 will position the text in the horizontal center of the video. |
verticalAlign | No | TOP CENTER BOTTOM | Relative vertical position of the text. The position is relative to the size of the video. So, a y value of 0.5 will position the text in the vertical center of the video. |
shadowColor | No | 0x000000 | The hexadecimal color value for the shadow |
shadowOffsetX | No | 0.08 | Percentage offset from the main text |
shadowOffsetY | No | 0.08 | Percentage offset from the main text |
shadowOpacity | No | 0.33333334 | Opacity of the shadow, value between 0-1. |
Advanced Settings:
{
"name": "A brand new template",
"description": "Here, we can describe our new template",
"settings": [
{
"content": "[%firstName%] [%lastName%]",
"fontColor": "FFFFFF",
"y": 0.02,
"x": 0.02,
"fontOpacity": 0.5,
"fontSize": 0.04,
"align": "LEFT",
"verticalAlign": "TOP",
"shadowColor": "000000",
"shadowOffsetX": 0.08,
"shadowOffsetY": 0.08,
"shadowOpacity": 0.33
},
{
"content": "ACME Studios",
"fontColor": "FFFFFF",
"y": 0.02,
"x": 0.98,
"fontOpacity": 0.5,
"fontSize": 0.04,
"align": "RIGHT",
"verticalAlign": "TOP",
"shadowColor": "000000",
"shadowOffsetX": 0.08,
"shadowOffsetY": 0.08,
"shadowOpacity": 0.33
},
{
"content": "PROPERTY OF ACME",
"fontColor": "FFFFFF",
"y": 0.5,
"x": 0.5,
"fontOpacity": 0.1,
"fontSize": 0.1,
"align": "CENTER",
"verticalAlign": "MIDDLE",
"shadowColor": "000000",
"shadowOffsetX": 0.08,
"shadowOffsetY": 0.08,
"shadowOpacity": 0.33
},
{
"content": "DO NOT DISTRIBUTE",
"fontColor": "FFFFFF",
"y": 0.96,
"x": 0.98,
"fontOpacity": 0.5,
"fontSize": 0.04,
"align": "RIGHT",
"verticalAlign": "MIDDLE",
"shadowColor": "000000",
"shadowOffsetX": 0.08,
"shadowOffsetY": 0.08,
"shadowOpacity": 0.33
}
]
}