All Products
Search
Document Center

ApsaraVideo Live:Get started with RTS

Last Updated:Jan 16, 2025

As the live streaming industry rapidly evolves, the demand for reduced latency intensifies. ApsaraVideo Live's Real-Time Streaming (RTS) feature significantly lowers live streaming latency from 3-6 seconds to milliseconds, enhancing user experience. RTS also offers improved resistance to packet loss, making it ideal for scenarios requiring 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.

Prerequisites

  • You have prepared an ingest domain and a streaming domain, and completed ICP filing. For more information, see .

    Note
    • If your live center is located outside China and the acceleration region is set to Outside Chinese Mainland, ICP filing is not required for the domain name.

    • If the ingest domain and streaming domain are second-level domains under the same top-level domain, you need to apply for an ICP filing only for the top-level domain.

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 video tutorial to learn how to activate ApsaraVideo Live. For more information, see Activate ApsaraVideo Live.

  1. Log on to the . In the top menu bar, choose Products > 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.

Procedure

Before you 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. For more information, see Add a domain name.

  1. Prepare domain names.

    • If you do not have a domain name, you can register one with Alibaba Cloud Domain Names. For more information, see Register a generic domain name.

    • If you want to provide services in the Chinese mainland, you must apply for an Internet Content Provider (ICP) number for your domain name. For more information, see ICP filing process.

      Note
      • If you want to try the basic features of ApsaraVideo Live, we recommend that you 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 domain and streaming domain are subdomains of a primary domain, ICP filling is required only for the primary domain.

  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.

  5. In the Add Domain Name step, configure parameters based on your business requirements.

    Important

    When you add a domain name to ApsaraVideo Live for the first time, ApsaraVideo Live verifies the ownership of the domain name. For more information, see Verify the ownership of a domain name.

    配置域名

    Show parameters

    Parameter

    Value

    Description

    Domain Type

    • Streaming Domain

    • Ingest Domain

    The type of the domain name. You can add an ingest domain or a streaming domain. This parameter cannot be modified once it is set.

    Note
    • To add an ingest domain, select Ingest Domain for the Domain Type parameter. To add a streaming domain, select Streaming Domain for the Domain Type parameter.

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

    Domain Name

    None

    Enter the domain name that you want to accelerate. Take note of the following items:

    • 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, Dynamic Route for CDN (DCDN), Secure CDN (SCDN), or Video Surveillance System.

    • After you activate ApsaraVideo Live, you can add up to 20 domain names to ApsaraVideo Live for each Alibaba Cloud 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. For more information about how to submit a ticket, see Contact us.

    • Content that is served from the domain name must comply with the limits of ApsaraVideo Live. For more information, see Verify a domain name.

    Note

    The specified subdomain must belong to the same Alibaba Cloud account. When you add a domain name, ApsaraVideo Live verifies the ownership of the domain name. If the specified subdomain name belongs to a different account, an error message appears.

    Acceleration Region

    Chinese Mainland

    • For an ingest domain, if the streamers are located in the Chinese mainland, select Chinese Mainland.

    • For a streaming domain, if the viewers are located in the Chinese mainland, select Chinese Mainland.

    Apply for an ICP filing from the Ministry of Industry and Information Technology of China (MIIT) for the domain name. We recommend that you use the Alibaba Cloud ICP Filing system.

    Global

    • For an ingest domain, if the streamers are located in the Chinese mainland, Hong Kong (China), Macao (China), Taiwan (China), and other countries and regions, select Global.

    • For a streaming domain, if the viewers are located in the Chinese mainland, Hong Kong (China), Macao (China), Taiwan (China), and other countries and regions, select Global.

    Apply for an ICP filing from the MIIT for the domain name. We recommend that you use the Alibaba Cloud ICP Filing system.

    Outside Chinese Mainland

    • For an ingest domain, if the streamers are located in countries and regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), select Outside Chinese Mainland.

    • For a streaming domain, if the viewers are located in countries and regions outside the Chinese mainland, including Hong Kong (China), Macao (China), and Taiwan (China), select Outside Chinese Mainland.

    • If you select Outside Chinese Mainland and the live center is located outside the Chinese mainland, you do not need to apply for an ICP filing for the domain name.

    • If you select Outside Chinese Mainland and the live center is located in the Chinese mainland, you must apply for an ICP filing for the domain name. We recommend that you apply for an ICP filing by using the Alibaba Cloud ICP Filing system.

    Note

    For more information about how to select the acceleration region, see the "How do I select the acceleration region for a domain name?" section of the FAQ topic.

    Live Center

    None

    A live center provides media processing features for live streams 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 more information about how to select a live center, see the "How do I select a live center?" section of the FAQ topic.

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

    image

Add CNAME records

Before you use the RTS service, you must map your domain names (ingest domain and streaming domain) to the CNAMEs 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 of a domain name is deployed in the Chinese mainland. If you configure region-specific DNS settings for your domain name, for example, you add a CNAME record for your domain name 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 that are assigned by Alibaba Cloud CDN, Dynamic Content Delivery Network (DCDN), ApsaraVideo Live, and ApsaraVideo VOD can be used only for domain name resolution. If Alibaba Cloud discovers 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: On the Domain Management page of the ApsaraVideo Live console, click Open Configuration Guide in the CNAME Status column of the domain name. In the CNAME Configuration Guide panel, click Verify in the Verify the CNAME record section. You can know whether the CNAME record takes effect from the verification result that is displayed.

    image

  • Method 2: Run the nslookup -type=cname yourdomain.com command. If the CNAME that is returned is the same as the CNAME that is assigned to the domain name in the ApsaraVideo Live console, the CNAME record takes effect.image

Associate the streaming domain with the ingest domain

Currently, RTS uses the edge ingest method. You need to associate the streaming domain with the ingest domain to ingest and play streams.

Note

You can watch the tutorial video to learn how to associate a streaming domain with an ingest domain. For more information, see associate a streaming domain with an ingest domain.

  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. The Streaming Management > Basic Settings page appears.

  2. On the Basic Settings page, click the Basic Information tab.

    On the Basic Information tab, you can view the CNAME record, the time when the domain name was created, the type of the domain name, the live center, the acceleration region, and the quota limits.基础信息

    Note
    • You can manage quotas of ApsaraVideo Live only in the China (Beijing), China (Shanghai), China (Shenzhen), and Singapore regions. To increase quotas for other live centers, submit a ticket. For more information, see Contact us.

    • For more information about how to manage quotas of ApsaraVideo Live, see Quota management.

    • For more information about how to modify the acceleration region, see the Modify the acceleration region section of this topic.

  3. Click the Stream Ingest Information tab.

  4. 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 purposes, configuring Secure Sockets Layer (SSL) certificates for both the ingest and streaming domains is necessary when implementing Real-Time Streaming (RTS) in a native browser. For more information, see Configure HTTPS secure acceleration.

Note

SSL certificates are not required if you are using the RTS SDK or the RTS demo.

Activate ApsaraVideo Live

Important

As of September 1, 2022, RTS and HTML5 auto transcoding are enabled by default for newly added streaming domains, requiring no additional configurations. For streaming domains added before this date, you must configure the settings manually.

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, click Domain Names to access the Domain Management page.

  3. Locate the streaming domain you want to enable for RTS and select Domain Settings from the Actions column.

  4. On the displayed page, navigate to Streaming Management > RTS.

  5. Enable RTS.

  6. In the dialog box that appears, select RTS 1.0 and enable HTML5 Auto Transcoding.

    Native browsers' WebRTC does not support B-frames or the AAC audio format. HTML5 auto transcoding provides adaptive transcoding to ensure smooth playback.

    • When using a browser to play a stream with B-frames and AAC audio, the B-frames are removed, the audio format is converted, and standard transcoding fees apply.

    • If the stream contains AAC audio but no B-frames, only the audio format is converted, incurring audio-only transcoding fees.

    • When a transcoding template is configured, it works alongside HTML5 auto transcoding for browser playback, but transcoding is billed only once.

    • Native SDK playback does not require transcoding as it supports both B-frames and the AAC audio format.

    Note
    • It may take a few minutes for the RTS configuration to propagate across the network. Please wait a few minutes before verifying that the configuration has been applied.

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

    • Although RTS (Real-Time Streaming) and standard streaming can operate under the same streaming domain, it is advisable to set up a dedicated streaming domain for RTS. This is because RTS relies on the User Datagram Protocol (UDP), in contrast to standard streaming, which utilizes the Transmission Control Protocol (TCP).

(Optional) Configure custom URL signing

The URL signing feature helps protect your origin server's resources from unauthorized access and downloads. By default, URL signing is activated for any domain name you add.

Depending on your business needs, you can use the default URL signing settings or opt for custom configurations. For the default settings, no further action is required. For custom settings, you need to specify the Primary Key, Secondary Key, and Validity Period parameters.

Note

To learn how to configure URL signing, you can watch the tutorial video.

  1. In the left-side navigation pane, select Domain Names. Locate the streaming domain with RTS enabled and click Actions under the Domain Settings column.

  2. Choose Streaming Management > Access Control. The Access Control page will be displayed.

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

    Note

    If URL signing is already enabled, click Modify to adjust the settings. If it is disabled, enable the URL Signing switch to configure the settings.

  4. Set up your URL signing configurations. The parameters are described in the following table.

    Parameter

    Description

    Authentication Type

    Streaming domains in ApsaraVideo Live support only Type A signing to protect resources on the origin server.

    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 view the primary key on the URL signing page by selecting Domain Names in the left-side navigation pane of the ApsaraVideo Live console, selecting the domain name that you want to configure, and choosing Domain Settings> > Access Control> > URL Signing. You can also change 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 for a signed URL under a domain name that you add is 1 day or 1,440 minutes. You can specify a custom validity period for the signed URL. The minimum value is 1 minute. There is no upper limit. Unit: minutes.

Generate ingest and streaming URLs

You can generate ingest and streaming URLs either through the console or by following specific concatenation rules.

Method 1: Use URL generator in the console

For quick generation of ingest and streaming URLs for testing, utilize the URL generator in the ApsaraVideo Live console. For more information, see URL generator.

Method 2: Use the concatenation rules

Before constructing an ingest or streaming URL, confirm whether the stream requires transcoding and if URL signing is necessary. Next, obtain the ingest domain, streaming domain, application name, stream name, and, if applicable, the transcoding template ID and access token. The table below describes the concatenation rules.

Type

Format

Concatenation Rules

Ingest URL

Supported formats include RTMP, RTS, and SRT, with RTMP being the recommended option.

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

Note

RTS (Real-Time Streaming) enables stream pulling via its own protocol.

Ingest Domain + AppName + StreamName + Access Token

Streaming URL

Supported formats include RTMP, FLV, M3U8, and RTS, with RTS being the recommended option.

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

The streaming domain, application name, stream name, and access token are combined to form a unique identifier.

Transcoded Stream URL

Note

Include the transcoding template ID when constructing a URL for a transcoded stream.

Supported formats include RTMP, FLV, M3U8, and RTS, with RTS being the recommended option.

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

The streaming domain, application name, stream name, transcoding template ID, and access token are combined to form a unique identifier.

Note
  • Ensure that the application name and stream name for the streaming domain correspond with those of the ingest domain to use the associated domains effectively.

  • A transcoding template ID is required to generate a transcoded stream URL. This ID can be found in the console. For more information, see Live Stream Transcoding.

  • An access token (auth_key) is an encrypted string created using the URL authentication algorithm and is necessary if URL signing is enabled. Use the MD5 algorithm to generate access tokens. For more information, see URL Signing.

  • When constructing a URL according to the concatenation rules, replace {transcoding template ID} or {access token} with the actual values, omitting the {} brackets.

Start RTS-based stream ingest

RTS recommends the RTMP format for stream ingest. This section provides an example of how to use OBS Studio for RTMP stream ingest. OBS Studio also supports the WebRTC-HTTP Ingestion Protocol (WHIP). For more information, see Use OBS to ingest an RTS stream. For RTS format stream ingest instructions, refer to the RTS-based stream ingest section.

  1. Download and install OBS Studio. For the download link, see OBS Studio.

  2. Launch OBS Studio.

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

  4. In the Settings menu, select Stream and enter the following details:

    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: To use OBS Studio for stream ingest, set the following video encoding parameters to eliminate B-frames:

    • Output Mode: Advanced

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

      Note

      It is recommended to set the keyframe interval to 1 second, not exceeding 3 seconds.

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

    • Profile: baseline

    • Tune: zerolatency

    OBS设置

  6. In OBS Studio's main interface, add a source in the Sources section and click Start Streaming.

    002

Note

If you encounter issues during stream ingest, use the troubleshooting tool for diagnosis. The tool helps identify common problems and offers solutions for specific exceptions. For more information, see Troubleshooting.

Start RTS playback

The table below details the players that are compatible with the RTS SDK for RTS playback. Alibaba Cloud RTS offers demo versions for both mobile and web platforms.

  • Integrated Players:

    Player

    References

    ApsaraVideo Player for mobile clients

    Native RTS streaming and playback

    ApsaraVideo Player for web

    Web SDK

  • For details on the RTS demo, refer to Playing an RTS Stream.

Note

If you experience issues during RTS stream playback, you can utilize the troubleshooting tool for assistance. This tool helps diagnose common streaming problems and offers targeted solutions for specific playback exceptions. For more information, visit Troubleshooting.

Compatibility with standard live streaming

Browsers that support WebRTC can natively play RTS streams with Opus audio format, eliminating the need for transcoding. When streaming with OBS Studio, Opus is the default audio format.

Audio transcoding

  1. Standard streaming protocols such as RTMP, FLV, and HLS only support the AAC audio format. To play RTS streams over these protocols, you must transcode the audio from Opus to AAC using a transcoding template.

  2. For details on configuring a transcoding template, see Live Stream Transcoding.

  3. Example: If you have an ingest domain rts-push.ialicdn.com and a streaming domain rts-pull.ialicdn.com, both with RTS 1.0 enabled, follow these steps to pull the stream over RTMP, FLV, or HLS:

    1. Set up a transcoding template for rts-pull.ialicdn.com to transcode audio from Opus to AAC. If a transcoding template is already in place, no new configuration is needed as Alibaba Cloud's templates default to AAC format.

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

Stream relay

  1. For RTS 2.0 streams that need to be played over standard protocols like RTMP, FLV, and HLS, enable Stream Relay on the ingest domain. This feature automatically generates and forwards an RTMP stream to a domain using standard protocols.

  2. For instructions on enabling Stream Relay, see Real-Time Streaming: Reduce Latency to 200–400 ms.

  3. Example: With ingest domain rtc-push.ialicdn.com and streaming domain rtc-pull.ialicdn.com both enabled for RTS 2.0, and additional domains rtmp-push.ialicdn.com and rtmp-pull.ialicdn.com for standard protocols, do the following:

    1. Activate Stream Relay for rtc-push.ialicdn.com and specify rtmp-push.ialicdn.com as the relay target. Ensure the standard streaming domain is set to rtmp-pull.ialicdn.com.

    2. To pull the stream, send playback requests to rtmp-pull.ialicdn.com via RTMP, FLV, or HLS.

Other operations: verify the latency of RTS

To verify the latency of RTS, you can incorporate a time calibrator URL during the stream ingest process and compare the streaming time with the standard time. Here's how to do this using OBS Studio.

On the OBS homepage, within the Sources section, add a time calibrator URL to the browser source. Then, click Start Streaming.