All Products
Search
Document Center

ApsaraVideo Live:AddLiveAISubtitle

更新時間:Aug 13, 2024

Adds a subtitle template.

Usage notes

  • You can call this operation to create a subtitle template. In the template, you can configure information such as the subtitle content and layout.
  • After you create a subtitle template, you need to call the AddLiveAIProduceRules operation to add a subtitle rule. The subtitles are displayed in the live stream after you re-ingest the live stream.
  • The live subtitles feature is available only in the following regions: China (Beijing), China (Shanghai), Singapore, Indonesia (Jakarta), and SAU (Riyadh - Partner Region).
Important The live subtitles feature is in invitational preview. You can add up to 300 subtitle templates.

QPS limit

You can call this operation up to 60 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limits.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes AddLiveAISubtitle

The operation that you want to perform. Set the value to AddLiveAISubtitle.

SubtitleName String Yes sub01

The name of the subtitle template. The name can contain only digits, letters, and hyphens (-). The name cannot start with a hyphen.

SrcLanguage String Yes zh-CN

The source language. Valid values:

  • en-US: English
  • zh-CN: Chinese
  • ru-RU: Russian
DstLanguage String No zh-CN

The target language. Valid values:

  • en-US: English
  • zh-CN: Chinese
  • es-ES: Spanish
  • ru-RU: Russian
FontColor String No 0xFFFFFF

The font color, which is an RGBA value.

FontName String No KaiTi

The font. Valid values:

  • KaiTi (default)
  • AlibabaPuHuiTi-Regular
  • AlibabaPuHuiTi-Bold
  • AlibabaPuHuiTi-Light
  • NotoSansHans-Regular
  • NotoSansHans-Bold
  • NotoSansHans-Light
BgColor String No 0xFF0000

The background color of the subtitles, which is an RGBA value.

PositionNormalized Array of Float Yes [0.32,0.27]

The position of the subtitles. The value is a pair of coordinates for which the origin of the x and y axes is the lower-left corner of the screen.

ShowSourceLan Boolean No true

Specifies whether to display the source language. Default value: false.

MaxLines Integer No 2

The number of displayed lines.

WordPerLine Integer Yes 20

The number of words displayed per line. Valid values: integers from 1 to 500.

FontSizeNormalized Float Yes 0.037

The font size. Valid values: [0,1].

BorderWidthNormalized Float No 0.05

The font weight. Valid values: [0,1].

BgWidthNormalized Float No 0.09

The background size of the subtitles. Valid values: [0,1].

CopyFrom String No sub01

The subtitle template that you copy. Set the value to the name of the subtitle template.

Description String No live AI subtitle template

The custom description of the subtitle template. The description can be up to 128 characters in length and can contain letters, digits, and special characters.

Width String No 1280

The preview width. Unit: pixels.

Height String No 720

The preview height. Unit: pixels.

The following specifications of preview width × preview height are supported:

  • Landscape low definition 360p (640×360)
  • Portrait low definition 360p (360×640)
  • Landscape standard definition 480p (854×480)
  • Portrait standard definition 480p (480×854)
  • Landscape high definition 720p (1280×720)
  • Portrait high definition 720p (720×1280)
  • Landscape ultra-high definition 1080p (1920×1080)
  • Portrait ultra-high definition 1080p (1080×1920)

Response parameters

Parameter

Type

Example

Description

RequestId String 5c6a2a0df228-4a64-af62-20e91b96****

The request ID.

SubtitleId String 445409ec-7eaa-461d-8f29-4bec2eb9****

The ID of the subtitle template.

Examples

Sample requests

http(s)://live.aliyuncs.com/?Action=AddLiveAISubtitle
&SubtitleName=sub01
&SrcLanguage=zh-CN
&DstLanguage=zh-CN
&FontColor=0xFFFFFF
&FontName=KaiTi
&BgColor=0xFF0000
&PositionNormalized=[0.32,0.27]
&ShowSourceLan=true
&MaxLines=2
&WordPerLine=20
&FontSizeNormalized=0.037
&BorderWidthNormalized=0.05
&BgWidthNormalized=0.09
&CopyFrom=sub01
&Description=live AI subtitle template
&Width=1280
&Height=720
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddLiveAISubtitleResponse>
    <RequestId>5c6a2a0df228-4a64-af62-20e91b96****</RequestId>
    <SubtitleId>445409ec-7eaa-461d-8f29-4bec2eb9****</SubtitleId>
</AddLiveAISubtitleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "5c6a2a0df228-4a64-af62-20e91b96****",
  "SubtitleId" : "445409ec-7eaa-461d-8f29-4bec2eb9****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter %s. One or more parameters are invalid.
400 MissingParameter %s. One or more required parameters are missing.

For a list of error codes, see Service error codes.