The live subtitles feature converts speech in live streams into subtitles through speech recognition and supports real-time translation between Chinese, English, Spanish, and Russian. This topic introduces how to use the feature.
Before you begin
This feature is supported in a limited number of regions. For availability, see Supported regions.
This feature is currently in public preview and charges no fees. After the public preview concludes, standard charges will apply. We will notify you in advance of any changes.
Procedure
ApsaraVideo Live adds live subtitles to streams based on the subtitle template and rule:
Subtitle template: It only defines subtitle configurations, including the content, layout, styling, and other visual settings. You can add up to 300 subtitle templates for an account.
Subtitle rule: It associates a subtitle template with live streams based on the domain name and AppName. After you configure the rule, the subtitle template is automatically applied to newly ingested live streams that match the domain name and AppName defined in the rule.
A subtitle template can be associated with multiple subtitle rules.
Step 1: Add a subtitle template
In the console
Log on to the ApsaraVideo Live console.
In the left-side navigation pane, select Feature Management > Live Subtitles. Then, select the Subtitle Templates tab.
Select a region and click Add Subtitle Template to configure the basic settings of the subtitles.

The console provides a preview for you to check the visual effect after adjustments. The following table describes the parameters that you can configure for the subtitle template:
Parameter | Description |
Creation Method |
|
Subtitle Template Name | The name of the subtitle template. It can contain digits, letters, and hyphens (-), but cannot start with a hyphen. |
Template Description | The description of the subtitle template. It can be up to 128 characters in length, and can contain letters, digits, and special characters. |
Source Language | Valid values: Chinese, English, and Russian. |
Translation | Valid values: Chinese, English, Spanish, Russian, No Translation.
|
Maximum Lines | The maximum number of lines to display. Valid values: integers from 1 to 300. |
Max Characters per Line | The maximum number of characters that can be contained in each line. Valid values: integers from 10 to 320. |
Font | Valid values:
|
Font Size | The size of the font. |
Subtitle Background | Specifies whether to display the subtitle background. When enabled, you can configure the color and opacity of the background. |
Color | The color and opacity of the text. |
Resolution (Width × Height) | Preview size. Valid values:
|
Click Submit to create the subtitle template.
After the subtitle template is added, a prompt will appear that reminds you to add a subtitle rule. You can click Add Now or Later.
To manage created templates, on the Subtitle Templates tab, click the desired operation in the Actions column:
Preview: Preview the visual effect of the subtitles.
Modify: Adjust the subtitle template configurations.
Delete: When a template is not associated with any subtitle rules (Bound Subtitle Rules=0), the button is clickable. Otherwise, it is grayed out. You must first delete the associated rule. Click Bound Subtitle Rules to view associated rules.
Add Subtitle Rule: Add a subtitle rule for this template. For details, see Step 2: Add a subtitle rule.
Changes to subtitle templates do not affect active streams. To apply modifications or deletions, re-ingest the stream.
By API
Call the AddLiveAISubtitle operation to add a subtitle template.
ApsaraVideo Live also provides the following interfaces for managing subtitle templates:
DeleteLiveAISubtitle: deletes a subtitle template.
UpdateLiveAISubtitle: updates a subtitle template.
DescribeLiveAISubtitle: queries subtitle templates.
Step 2: Add a subtitle rule
In the console
Log on to the ApsaraVideo Live console.
In the left-side navigation pane, select Feature Management > Live Subtitles. Then, select the Subtitle Rules tab.
Select the region where the target template is created. The rule can only be applied to domain name in the same region. Then, click Add Subtitle Rule.

Parameter | Description |
Rule Description | The description of the subtitle rule. It can be up to 128 characters in length and can contain letters, digits, and special characters. |
Streaming Domain | The primary streaming domain to which the rule is applied. |
AppName | The name of the application to which the live streams belongs. It must be the same as the application name specified in the ingest URL. The value can be up to 256 characters in length and can contain digits, letters, hyphens (-), and underscores (_). |
Subtitle Templates | The subtitle template to be associated with the rule. |
Output Settings | We recommend that you set the output resolution the same as the resolution defined in the subtitle template. Valid values:
|
Triggered by Stream Pulling | Specifies whether to trigger the subtitles by stream pulling.
|
Click Submit to create the rule.
NoteAfter you configure the subtitle rule, re-ingest the stream to display the subtitles.
To manage created rules, on the Subtitle Rules tab, click the desired operation in the Actions column:
Preview: Preview the visual effect of the subtitles.
Edit: Adjust the subtitle rule configurations.
Delete: Delete the subtitle rule.
By API
Call the AddLiveAIProduceRules operation to add a subtitle rule.
ApsaraVideo Live also provides the following interfaces for managing subtitle rules:
UpdateLiveAIProduceRules: updates a subtitle rule.
DeleteLiveAIProduceRules: deletes a subtitle rule.
DescribeLiveAIProduceRules: queries subtitle rules.
Step 3: Ingest a stream
Use the URL generator in the ApsaraVideo Live console or follow the concatenation rules in code to construct an ingest URL. For more information, see Generate ingest and streaming URLs.
Ingest the stream to the generated URL using OBS, Push SDK provided by ApsaraVideo Live, or other tools.
Step 4: Play the subtitle stream
Use the following concatenation rules to construct a streaming URL for playing the stream with live subtitles:
Format: Protocol + Streaming domain + AppName + StreamName
_Subtitle template name+ {Access token}Examples:
RTMP: rtmp://example.aliyundoc.com/app/stream_{Subtitle template name}?auth_key={Access token}
FLV: http://example.aliyundoc.com/app/stream_{Subtitle template name}.flv?auth_key={Access token}
M3U8: http://example.aliyundoc.com/app/stream_{Subtitle template name}.m3u8?auth_key={Access token}
Pull the stream from the generated streaming URL using the VLC media player, ApsaraVideo Player SDK, or other tools.
Live subtitle streams do not support playback over the ARTC protocol.