Common Timeline configuration examples for text overlays in OpenAPI-based video editing, covering full-duration overlays, specified-region overlays, external subtitles, and word art styles.
Related APIs
Parameters
|
Parameter |
Description |
|
Text coordinates |
The value can be a percentage or a pixel value:
|
|
Text properties |
|
|
Time range for the text overlay |
|
Timeline examples
Full-duration text overlay
A full-duration text overlay appears throughout the entire video. You do not need to specify TimelineIn and TimelineOut. The text position in the output video is determined by X and Y. Example:
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "ea9a6f9bdb68419abfd36a7113cf****",
"Effects": [
{
"Type": "Text",
"X": 31,
"Y": 93,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 0.2,
"FontColor": "#000000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 30,
"Y": 92,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#FFFFFF"
},
{
"Type": "Text",
"X": 0.8123,
"Y": 0.7896,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 0.2,
"FontColor": "#000000"
},
{
"Type": "Text",
"X": 0.8223,
"Y": 0.7796,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#FFFFFF"
}
]
}
]
}
]
}
Specified-region text overlay
A specified-region text overlay displays text within a specific time range. The text position in the output video is determined by X and Y. The following example overlays text from 0 to 5 seconds and from 5 to 10 seconds:
-
If
TimelineInis not set, the default value is 0. -
If you do not set
TimelineOut, the overlay continues to the end of the video by default. -
If the value of
TimelineOutexceeds the video duration, the overlay ends at the end of the video track.
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "ea9a6f9bdb68419abfd36a7113cf****",
"Effects": [
{
"Type": "Text",
"X": 31,
"Y": 93,
"TimelineIn": 0,
"TimelineOut": 5,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 0.2,
"FontColor": "#000000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 30,
"Y": 92,
"TimelineIn": 0,
"TimelineOut": 5,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#FFFFFF"
},
{
"Type": "Text",
"X": 1124,
"Y": 516,
"TimelineIn": 5,
"TimelineOut": 10,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 0.2,
"FontColor": "#000000"
},
{
"Type": "Text",
"X": 1123,
"Y": 515,
"TimelineIn": 5,
"TimelineOut": 10,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Test text",
"FontSize": 26,
"FontColorOpacity": 1,
"FontColor": "#FFFFFF"
}
]
}
]
}
]
}
Word art styles
Word art is a special text caption style based on banner text effects. Example:
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "MediaId1",
"Effects": [
{
"Type": "Text",
"X": 33,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Word art with shadow and outline - First line of test text",
"OutlineColour": "#ee00ff",
"BackColour": "#CE1212",
"EffectColorStyle": "skyline",
"Angle": 300,
"Outline": 2,
"Shadow": 3,
"FontSize": 42,
"FontColorOpacity": 1,
"FontColor": "#000000",
"FontFace": {
"Bold": true,
"Italic": false,
"Underline": false
}
},
{
"Type": "Text",
"X": 66,
"Y": 256,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Second line of text",
"EffectColorStyle": "golden",
"Angle": 60,
"FontSize": 38,
"FontColorOpacity": 0.8,
"FontColor": "#d60e0e"
},
{
"Type": "Text",
"X": 0.7123,
"Y": 0.7896,
"TimelineIn": 5,
"TimelineOut": 20,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "Third line of text",
"FontSize": 26,
"FontColor": "#000000"
}
]
}
]
}
]
}
Word art parameters
|
Parameters |
Type |
Description |
|
EffectColorStyle |
string |
The type of the word art style. For more information about word art styles and effects, see Word art effect examples. |
|
OutlineColour |
string |
The outline color. The color is a 6-digit hexadecimal RGB value in the #xxyyzz format. |
|
BackColour |
string |
The shadow color. The color is a 6-digit hexadecimal RGB value in the #xxyyzz format. |
|
Shadow |
int |
The shadow depth in pixels for the word art. Default value: 0. The recommended ratio of shadow depth to font size is 2:25. For example, if the font size is 25, set the shadow depth to 2. |
|
Outline |
int |
The outline width in pixels for the word art. Default value: 0. The recommended ratio of outline width to font size is 2:25. For example, if the font size is 25, set the outline width to 2. |
|
Spacing |
int |
The spacing between characters, in pixels. |
|
Angle |
float |
The pre-rotation angle of the subtitle line, in degrees. Valid values: 0 to 360. |