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
Video editing and the two methods about how to use the media editing service are introduced in Overview. You can call the ProduceEditingProjectVideo operation to initiate and implement the media editing service. The timeline is the key data processed by the media editing service and the core object in video editing. The internal parameters of the timeline can be organized in multiple ways to meet requirements in different business scenarios.
Parameters
Parameter | Description |
---|---|
Coordinates of the text overlaid on the output video |
|
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"
}
]
}
]
}
]
}