This topic describes the parameters of text overlay. This topic also provides examples of overlay in the full-time interval and overlay in the specified time interval. The following examples show how timeline data is organized for text overlay.
Overview
You can call the ProduceEditingProjectVideo operation to merge videos. The timeline data is essential in video editing. For more information about video editing and merging, see Overview. You can configure the parameters of the timeline in different ways based on your requirements.
Parameters
Parameter | Description |
Coordinates of the text overlaid on the output video |
You can set the value to a percentage or the number of pixels.
|
Text attributes |
|
Time interval when the text is overlaid on the output video |
|
Example of overlay in the full-time interval
This action overlays text on a video from the start time to the end time of the entire video. You do not need to set the TimelineIn
or TimelineOut
parameter. The position of the text in the output video is specified 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"
}
]
}
]
}
]
}
Overlay in the specified time interval
This action overlays text on a video in the specified time interval of the video. The position of the text in the output video is specified by X
and Y
. The following code provides an example on how to overlay text on a video from the 0th second to the 5th second and from the 5th second to the 10th second:
By default, if the
TimelineIn
parameter is not set, the text is overlaid from the start time of the video.By default, if the
TimelineOut
parameter is not set, the text remains overlaid until the video ends.If the
TimelineOut
value exceeds the total duration of a single video, the excess time interval is automatically excluded and the text remains overlaid until the end time of the video.
{
"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
Word art is a special text style based on banner text effects. Example:
{
"VideoTracks": [
{
"VideoTrackClips": [
{
"MediaId": "MediaId1",
"Effects": [
{
"Type": "Text",
"X": 33,
"Y": 34,
"Font": "WenQuanYi Zen Hei Mono",
"Content": "The first paragraph of shaded and framed 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": "The second paragraph of test 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": "The third paragraph of test text",
"FontSize": 26,
"FontColor": "#000000"
}
]
}
]
}
]
}
Word art parameters
Parameter | Type | Description |
EffectColorStyle | string | The type of the word art effect. For more information, see Word art effect examples. |
OutlineColour | string | The outline color, expressed as a 6-digit hexadecimal RGB value in the #xxyyzz format. |
BackColour | string | The shadow color, expressed as a 6-digit hexadecimal RGB value in the #xxyyzz format. |
Shadow | int | The shadow depth. Unit: pixels. Default value: 0. The recommended ratio between the shadow depth and the font size is 2:25. For example, if the font size is set to 25, the shadow depth is set to 2. |
Outline | int | The outline width. Unit: pixels. Default value: 0. The recommended ratio between the outline width and the font size is 2:25. For example, if the font size is set to 25, the outline width is set to 2. |
Spacing | int | The text spacing. Unit: pixels. |
Angle | float | The angle by which the subtitle line is pre-rotated. Valid values: [0,360]. |