All Products
Search
Document Center

ApsaraVideo Live:Get started with RTS

Last Updated:Apr 18, 2025

ApsaraVideo Live provides the Real-time Streaming (RTS) service to reduce the live streaming latency from 3-6 seconds to milliseconds, which improves user experience. RTS also offers stronger resistance to packet loss. It is suitable for scenarios that require ultra-low latency and real-time interaction, such as e-commerce live streaming, online education, live sports, and live shows. This topic describes how to implement RTS. 

Procedure

  1. Activate ApsaraVideo Live

  2. Add an ingest domain and a streaming domain

  3. Add CNAME records

  4. Associate the streaming domain with the ingest domain

  5. (Optional) Configure SSL certificates

  6. Enable RTS

  7. (Optional) Configure custom URL signing

  8. Generate ingest and streaming URLs

  9. Start RTS-based stream ingest

  10. Start RTS playback

Activate ApsaraVideo Live

Note

You can watch the tutorial video to learn how to activate ApsaraVideo Live.

  1. Log on to the Alibaba Cloud official website. In the top navigation bar, choose Products > Media Services > ApsaraVideo Live. The ApsaraVideo Live homepage appears.

  2. Click Activate Now.

  3. On the ApsaraVideo Live activation page, select Pay-By-Traffic as the metering method. Read and agree to the ApsaraVideo Live Terms of Service.

  4. Click Activate Now.

Add an ingest domain and a streaming domain

To use RTS, you must add an ingest domain and a streaming domain.

Note

You can watch the tutorial video to learn how to add a domain name.

  1. Prepare domain names.

    • If you do not have one, register one with Alibaba Cloud Domain Names

    • To provide services in the Chinese mainland, you must apply for an Internet Content Provider (ICP) number for your domain name.

      Note
      • To try the basic features, select a live center in a region outside the Chinese mainland and set the acceleration region to Outside Chinese Mainland. This eliminates the need for ICP filing.

      • If the ingest and streaming domains are subdomains, ICP filling is required only for the primary one.

  2. Log on to the ApsaraVideo Live console.

  3. In the left-side navigation pane, click Domain Names. The Domain Management page appears.

  4. Click Add Domain.

    To add a subdomain, append a prefix to the domain name you have registered. The subdomain does not require separate registration. Ensure you can differentiate between the ingest and streaming subdomains.

  5. In the Add Domain Name step, configure parameters as needed.

    Important

    When you add a domain name for the first time, ApsaraVideo Live verifies its ownership.

    配置域名

    Show parameters

    Parameter

    Valid value

    Description

    Domain Type

    • Streaming Domain

    • Ingest Domain

    The type of the domain name. It cannot be modified once set.

    Note

    You cannot add a domain name as both an ingest domain and a streaming domain.

    Domain Name

    N/A

    Enter the domain name that you want to accelerate. Note the following:

    • In most cases, use a subdomain as an accelerated domain name. Example: demo.aliyundoc.com.

    • ApsaraVideo Live does not support wildcard domain names, such as *.aliyundoc.com.

    • Duplicate accelerated domain names are not allowed. If the error message The specified domain already exists is displayed, check whether the domain name is added to other cloud services such as ApsaraVideo VOD.

    • You can add up to 20 domain names to ApsaraVideo Live for each account. If the average daily peak bandwidth of your domain names exceeds 50 Mbit/s, you can submit a ticket to increase the quota of domain names. Make sure that the quota increase does not incur business risks.

    • Content served from the domain name must meet the compliance requirements of ApsaraVideo Live.

    Note

    The specified subdomain must belong to the same Alibaba Cloud account. If not, an error message appears.

    Acceleration Region

    • Chinese Mainland

    • Global

    • Outside Chinese Mainland

    If the streamers or viewers are located in the Chinese mainland, select Chinese Mainland.

    If they are located around the world, select Global.

    If they are located in countries and regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), select Outside Chinese Mainland.

    In the following cases, ICP filing is required:

    • Acceleration Region is set to Chinese Mainland or Global.

    • Acceleration Region is set to Outside Chinese Mainland, but the selected live center is in Chinese Mainland.

    For further guidance, see How do I select the acceleration region for a domain name?

    Live Center

    See Supported regions.

    A live center provides media processing services in the cloud, such as snapshot capture, recording, transcoding, and production studio.

    The live center of an ingest domain must be located in the same region as that of the associated streaming domain. This parameter cannot be modified once it is set.

    For further guidance, see How do I select a live center.

  6. Note down the generated CNAME record for use in the next step.

    image

Add CNAME records

Before you use RTS, you must add CNAME records at your DNS provider to map your ingest domain and streaming domain to the CNAME that is assigned by ApsaraVideo Live. The following example shows how to add a CNAME record when your DNS provider is Alibaba Cloud. For information about how to add a CNAME record at other DNS providers, see Add a CNAME record.

Note
  • The server that Alibaba Cloud CDN uses to resolve the CNAME is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain name, for example, you add a CNAME record in regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), the domain name cannot be mapped to the CNAME. The status of the CNAME is Pending Configuration in the Alibaba Cloud CDN console. However, CDN acceleration for the domain name is not affected. 

  • CNAMEs assigned by Alibaba Cloud CDN, DCDN, ApsaraVideo Live, and ApsaraVideo VOD can be used only for domain name resolution. If Alibaba Cloud detects that your CNAME is used for unauthorized or malicious activities, Alibaba Cloud reserves the right to close your Alibaba Cloud account and remove the domain names.

  1. Log on to the Alibaba Cloud DNS console.

  2. In the left-side navigation pane, click Domain Name Resolution. The Domain Name Resolution page appears.

  3. Find the domain name for which you want to add a CNAME record and click DNS Settings in the Actions column.

  4. Click Add DNS Record and configure the parameters that are described in the following table.001

    Parameter

    Description

    Record Type

    Select CNAME from the drop-down list.

    Hostname

    Specify a prefix for the domain name. For more information about regular prefixes of domain names and sample domain names, see the following table.

    DNS Request Source

    Use the default value.

    Record Value

    Enter the CNAME that you obtained.

    TTL Period

    Use the default value.

    Prefix

    Sample domain name

    Description

    demo

    demo.aliyundoc.com

    The subdomain name.

    @

    aliyundoc.com

    The root domain name.

    *

    *.aliyundoc.com

    The wildcard domain name.

  5. Click OK.

Check whether a CNAME record takes effect

  • Method 1: Click CNAME Configuration Guide. In the right-side panel, click Verify in the Verify the CNAME record section.

    image

  • Method 2: Run the nslookup -type=cname yourdomain.com command. If the returned result is consistent with the CNAME value of the domain name in the ApsaraVideo Live console, the CNAME configuration takes effect. image

Associate the streaming domain with the ingest domain

To ingest and play streams, you must associate the streaming domain with the ingest domain.

Note

You can watch the tutorial video to learn how to associate them.

  1. In the left-side navigation pane, click Domain Names. On the page that appears, find the streaming domain that you added and click Domain Settings in the Actions column. You are directed to Streaming Management > Basic Settings.

  2. Click the Stream Ingest Information tab.

  3. Click Add Stream Ingest Information or the Edit icon next to Ingest Domain and select the ingest domain that you want to associate.

(Optional) Configure SSL certificates

For security reasons, if you want to implement RTS in a native browser, you must configure Secure Sockets Layer (SSL) certificates for the ingest and streaming domains. For more information, see Configure HTTPS secure acceleration.

Note

If you use native Push and ApsaraVideo Player SDKs or demos, SSL certificates are not required.

Enable RTS

Important

From September 1, 2022, RTS and HTML5 auto transcoding are enabled by default for newly added streaming domains. For streaming domains that were added before September 1, 2022, you must manually configure the settings.

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, click Domain Names. The Domain Management page appears.

  3. Find the streaming domain for which you want to enable RTS and click Domain Settings in the Actions column.

  4. On the page that appears, choose Streaming Management > RTS.

  5. Turn on RTS.

  6. In the dialog box that appears, choose RTS 1.0 and turn on HTML5 Auto Transcoding.

    The WebRTC of native browsers does not support B-frames and the AAC audio format. To ensure smooth playback, HTML5 auto transcoding performs adaptive transcoding.

    • If you use a browser to play a stream that contains B-frames and AAC audio, the B-frames are removed and the audio format is converted. You are charged for standard transcoding fees.

    • If you use a browser to play a stream that contains AAC audio but does not contain B-frames, the audio format is converted. You are charged for audio-only transcoding fees.

    • If you use a browser to play a stream and have configured a transcoding template, HTML5 auto transcoding and the transcoding template both take effect. The transcoding is billed only once.

    • If you use native SDK to play a stream, transcoding is not required because the SDK supports B-frames and the AAC audio format.

    Note
    • After you enable RTS, wait a few minutes and then check whether the configuration takes effect.

    • To associate an ingest domain with multiple streaming domains, see Bind a sub-streaming domain to a main streaming domain.

    • RTS and standard streaming can share the same streaming domain. However, we recommend that you configure a separate streaming domain for RTS because RTS uses User Datagram Protocol (UDP) while standard streaming uses Transmission Control Protocol (TCP).

(Optional) Configure custom URL signing

URL signing protects resources on origin servers from unauthorized access and downloads. By default, it is enabled for a domain name.

You can use the default or custom URL signing settings based on your business requirements. To use the custom settings, specify the Primary Key, Secondary Key, and Validity Period parameters.

Note

You can watch the tutorial video to learn how to configure URL signing.

  1. In the left-side navigation pane of the ApsaraVideo Live console, choose Domain Names. On the Domain Name Management page, find the streaming domain for which RTS is enabled and click Domain Settings in the Actions column.

  2. Choose Streaming Management > Access Control.

  3. Click the URL Signing tab. Then, click Modify.

  4. Configure the URL signing settings. The following table describes the parameters.

    Parameter

    Description

    Authentication Type

    Streaming domains in ApsaraVideo Live support only Type A signing.

    Note

    If URL signing fails, HTTP status code 403 is returned. In this case, you must recalculate the signature.

    • Invalid MD5 value

      Example: X-Tengine-Error:denied by req auth: invalid md5hash=de7bfdc915ced05e17380a149bd760be

    • Invalid timestamp

      Example: X-Tengine-Error:denied by req auth: expired timestamp=1439469547

    Primary Key

    After you add a domain name, ApsaraVideo Live generates a random primary key. You can modify the primary key.

    Secondary Key

    Specify a custom secondary key.

    Validity Period

    The signed URL can be used to initiate stream ingest or streaming requests only within the validity period. Persistent connections are established for stream ingest and streaming. Stream ingest and streaming requests that are initiated within the validity period are not dropped after the validity period expires. New stream ingest and streaming requests fail to be initiated after the validity period expires. 

    The default validity period is 1 day or 1,440 minutes. You can specify a custom validity period. The minimum value is 1 minute. There is no upper limit.

Generate ingest and streaming URLs

You can generate ingest and streaming URLs in ApsaraVideo Live console or construct them by using the concatenation rules.

Method 1: Use URL generator in the console

To quickly generate ingest and streaming URLs for testing purposes, use URL generator in the ApsaraVideo Live console. For more information, see URL generator.

Method 2: Use the concatenation rules

Before you construct an ingest or streaming URL, verify whether the stream is transcoded and whether URL signing is required. Then, retrieve the ingest domain, streaming domain, application name, stream name, transcoding template ID (optional), and access token (optional). The following table outlines the concatenation rules.

Type

Format

Concatenation rules

Ingest URL

Supported formats include RTMP, RTS, and SRT. RTMP is recommended.

RTMP URL example:

rtmp://demo.aliyundoc.com/app/stream?auth_key={access token}

Note

RTS allows you to pull streams over RTS.

Ingest domain + Application name + Stream name + Access token

Streaming URL

Supported formats include RTMP, FLV, M3U8, and RTS. RTS is recommended.

RTS URL example:

artc://example.aliyundoc.com/app/stream?auth_key={access token}

Streaming domain + Application name + Stream name + Access token

Transcoded stream URL

Note

You must provide a transcoding template ID to construct a transcoded stream URL.

Supported formats include RTMP, FLV, M3U8, and RTS. RTS is recommended.

RTS URL example:

artc://example.aliyundoc.com/app/stream_{transcoding template ID}?auth_key={access token}

Streaming domain + Application name + Stream name + Transcoding template ID + Access token

Note
  • Associated streaming domain and ingest domain can be properly used only if the application name and stream name of the streaming domain match those of the ingest domain. 

  • You must provide a transcoding template ID to generate a transcoded stream URL. You can view the transcoding template ID in the console. For more information, see Transcoding management

  • An access token (auth_key) is an encrypted string that is generated based on the URL authentication algorithm. Access tokens are required if you enable URL signing. You can use the MD5 algorithm to obtain access tokens. For more information, see Ingest and streaming URL signing

  • When you construct a URL by using the concatenation rules, replace {Transcoding template ID} or {Access token} with the actual value without {}.

Start RTS-based stream ingest

We recommend that you use the RTMP format for RTS-based stream ingest. In the following example, OBS Studio is used to ingest streams over RTMP. OBS Studio also supports ingesting RTS streams based on WebRTC-HTTP Ingestion Protocol (WHIP). For more information, see Use OBS to ingest an RTS stream. For other methods, see Stream ingest for RTS.

  1. Download and install OBS Studio. Download link: OBS Studio.

  2. Launch OBS Studio.

  3. In the menu bar, select File > Settings.

  4. On the Settings page, select Stream and configure the following information:

    001

    Parameter

    Description

    Service

    Select Custom...

    Server

    Enter the signed ingest URL generated. Example: rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************

    Stream Key

    Leave this parameter empty.

  5. Optional: On the Settings page, click Output and configure the following parameters to remove B-frames.

    • Output Mode: Advanced

    • Keyframe Interval (seconds, 0=auto): 1

      Note

      We recommend that you set a keyframe interval no greater than 3 seconds. This example uses 1 second.

    • CPU Usage Preset (higher = less CPU): veryfast

    • Profile: baseline

    • Tune: zerolatency

    OBS设置

  6. Go to the homepage of OBS Studio. Find the Sources section, add a source, and click Start Streaming.

    002

Note

If you encounter exceptions during stream ingest, you can use the troubleshooting tool to troubleshoot the issues. The tool allows you to diagnose common stream ingest issues and provides suggestions to resolve specific exceptions. For more information, see Troubleshooting.

Start RTS playback

The following table lists the players integrated with RTS SDK for RTS playback. Alibaba Cloud RTS provides demos for both mobile and web clients.

Note

If you encounter playback exceptions during streaming, you can use the troubleshooting tool to troubleshoot the issues. The tool allows you to diagnose common stream playback issues and provides suggestions to resolve specific exceptions. For more information, see Troubleshooting.

Compatibility with standard live streaming

By default, browsers supporting WebRTC can play RTS streams with Opus audio format, so transcoding is not required. When you use OBS Studio for stream ingest, the default audio format is Opus.

Audio transcoding

Protocols for standard streaming, such as RTMP, FLV, and HLS, support only AAC audio format. If you use RTS 1.0 for stream ingest and want to play the RTS streams over standard live streaming protocols, you must configure a transcoding template to transcode the audio from Opus to AAC format. For information about how to configure a transcoding template, see Live stream transcoding.

Example

Suppose that you have an ingest domain rts-push.ialicdn.com and a streaming domain rts-pull.ialicdn.com. Both domains have RTS 1.0 enabled. To pull the stream over RTMP, FLV, or HLS, perform the following operations:

  1. Configure a transcoding template for the streaming domain rts-pull.ialicdn.com to transcode the audio from Opus to AAC format. If you have already configured a transcoding template, you do not need to add a new one, because Alibaba Cloud transcoding templates convert the audio to AAC format by default.

  2. Send playback requests to rts-pull.ialicdn.com over RTMP, FLV, or HLS to play the transcoded stream.

Stream relay

If you use RTS 2.0 for stream ingest and want to play the RTS streams over standard live streaming protocols, such as RTMP, FLV, and HLS, you can enable Stream Relay for the ingest domain. After you enable this feature, an RTMP stream is automatically generated and relayed to a specified domain name that uses standard live streaming protocols. For information about how to enable stream relay, see Configure stream relay.

Example

Suppose that you have an ingest domain rtc-push.ialicdn.com and a streaming domain rts-pull.ialicdn.com. Both domains have RTS 2.0 enabled. In addition, you have another ingest domain and streaming domain: rtmp-push.ialicdn.com and rtmp-pull.ialicdn.com, which use standard live streaming protocols. If you ingest a stream to rtc-push.ialicdn.com, perform the following operations to pull the stream over RTMP, FLV, or HLS:

  1. Enable Stream Relay for rtc-push.ialicdn.com. Enter rtmp-push.ialicdn.com in the Relayed To field.

  2. Use rtmp-pull.ialicdn.com for stream pulling. Send playback requests to rtmp-pull.ialicdn.com over RTMP, FLV, or HLS to play the transcoded stream.

Verify the latency of RTS

You can add a time calibrator URL during stream ingest to verify the latency of RTS by comparing the streaming time with UTC.

For example, in OBS Studio, go to the homepage, add a time calibrator URL in the Sources section, and then click Start Streaming.