Migrate from standard streaming to RTS

更新时间:
复制 MD 格式

ApsaraVideo Live supports seamless upgrades from standard streaming to Real-Time Streaming (RTS). If you already use standard streaming, you can enable RTS to use both services simultaneously.

Prerequisites

You have activated the ApsaraVideo Live service and completed the required configurations for standard streaming as described in Quick Start for ApsaraVideo Live. The configurations for standard streaming must be completed in the following order:

  1. Step 1: Add ingest and streaming domains

  2. Step 2: Add a CNAME record to enable acceleration

  3. Step 3: Associate an ingest domain with a streaming domain

Step 1: Enable RTS

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, choose Live + > RTS.

  3. Select the streaming domain where you want to enable RTS.

  4. Turn on the RTS switch and select a latency mode based on your business needs: Sub-second (End-to-End Latency: 400-800 ms) or Half-second (End-to-End Latency: 200-400 ms).

    Review the compatibility and limitations of each latency option before making a selection.

Sub-second latency

  1. Features: Delivers an end-to-end latency of 400 ms to 800 ms with high compatibility. This mode is ideal for low-latency live streaming scenarios that require compatibility with standard streaming and other ingest or playback protocols.

  2. Protocol support: Supports ARTC (based on WebRTC) for stream ingest and stream playback. It is forward-compatible with standard streaming and supports RTMP ingest, origin pull, and common playback protocols such as RTMP, FLV, and HLS.

  3. Ingest and playback tools: Compatible with common industry tools. We recommend using the Alibaba Cloud Ingest SDK and the ApsaraVideo Player SDK.

  4. Other notes: If the ingest stream contains B-frames or uses an audio codec other than Opus, the system automatically transcodes the stream for web playback, which incurs transcoding fees.

    When using the ApsaraVideo Web SDK for playback, the underlying WebRTC engine does not natively support B-frames and requires the Opus audio codec. To ensure a smooth playback experience, the system automatically triggers transcoding based on the content of the ingest stream:

    • If the ingest stream contains both B-frames and AAC audio, the system automatically transcodes the video to remove B-frames and the audio to convert AAC to Opus. You are charged standard video transcoding fees based on the source resolution.

    • If the ingest stream does not contain B-frames but contains AAC audio, the system triggers audio-only transcoding to convert AAC to Opus. You are charged for audio-only transcoding.

    • If you have also configured a transcoding template, the system performs B-frame removal and Opus conversion in addition to the operations defined in the template. You are charged for the combined transcoding operations.

    When using the ApsaraVideo Native SDK for playback, no automatic transcoding is triggered and no extra fees are incurred because the native SDK supports both B-frames and AAC.

Half-second latency

  1. Features: Achieves an end-to-end latency of 200 ms to 400 ms. This mode is suitable for scenarios that demand the lowest possible latency.

  2. Protocol support: Supports ARTC (based on WebRTC) for stream ingest and stream playback. This mode is not compatible with standard streaming and does not support RTMP ingest, origin pull, or playback using common protocols like RTMP, FLV, and HLS.

  3. Ingest and playback tools: For stream ingest, you can use OBS with the WHIP protocol or the Alibaba Cloud Ingest SDK. For stream playback, you must use the ApsaraVideo Player SDK.

  4. Other notes: Cloud features such as transcoding and recording in this mode are not available for the streaming domain. However, you can use a stream forwarding configuration to make the stream available on another domain.

    • Click Configure Stream Relay and select an ingest domain that is associated with a streaming domain and does not have the half-second latency mode or dual-stream disaster recovery enabled. This domain will receive the forwarded RTMP stream. For example, you can forward the stream to an ingest domain push.example.com, which is associated with the streaming domain pull.example.com. After the configuration is complete, you can pull the stream from pull.example.com by using standard streaming protocols and use cloud features like transcoding and recording.

Note
  • The RTS configuration may take several minutes to deploy across the network. Wait a few minutes before testing.

  • If you need to associate one 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, because RTS uses UDP and standard streaming uses TCP, their underlying technologies are different. We recommend using a dedicated streaming domain for RTS.

Step 2: Generate ingest and streaming URLs

Method 1: Generate URLs in the console

After you enable RTS, you can use the stream testing tool in the console. Click Generate URLs, enter an application name and a stream name, and the tool generates ARTC-based RTS ingest and streaming URLs.

In the console, you must first enable the Real-Time Streaming switch and select a latency mode: sub-second latency (400 ms to 800 ms end-to-end latency, supports RTMP/ARTC ingest and HLS/FLV/RTMP/ARTC playback) or half-second latency (200 ms to 400 ms end-to-end latency, supports only ARTC ingest and playback). The generated URL list includes multiple protocol formats for ingest and playback, such as artc://, rtmp://, and http://.

Method 2: Manually construct URLs

Before constructing ingest and streaming URLs, determine whether the stream will be transcoded and whether URL signing is enabled. Then, prepare the required information: ingest domain, streaming domain, application name, stream name, transcoding template ID (if applicable), and access token (if applicable).

URL type

Format

Construction rule

Ingest URL

Supports RTMP, RTS, and SRT formats. We recommend using the RTMP format for stream ingest. Example:

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

Note

RTS also supports stream playback by using RTS URLs.

ingest domain + application name + stream name + access token

Streaming URL

Supports RTMP, FLV, M3U8, and RTS formats. We recommend using the RTS format for stream playback. Example:

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

streaming domain + application name + stream name + access token

Transcoded stream URL

Note

If you configure a transcoding template, you must use the corresponding transcoded stream URL.

Supports RTMP, FLV, M3U8, and RTS formats. We recommend using the RTS format for stream playback. Example:

RTS: artc://example.aliyundoc.com/app/stream_{template_id}?auth_key={access_token}

streaming domain + application name + stream name_transcoding template ID + access token

Note
  • For associated ingest and streaming domains, use identical application and stream names for both stream ingest and stream playback.

  • A transcoded stream URL requires a transcoding template. You can find the transcoding template ID in the console. For more information, see Live stream transcoding.

  • The access token (auth_key) is an encrypted string required only when URL signing is enabled. You can use the MD5 algorithm to generate the access token. For more information, see Signed URL Components.

  • When you customize the URL, directly replace {Transcoding Template ID} or {Access Token} with the actual data. Do not include the {} symbols around the actual data.

Step 3: Start RTS ingest and playback

After you enable RTS and generate the URLs, you can use the Try RTS in the console to test RTS ingest and playback. The tool supports streaming from your camera or sharing your screen.

Note

The stream testing tool in the console uses a proxy signaling domain for quick testing. If you are integrating the Web SDK into your own application, you must configure an SSL certificate for your domains and set the correct Access-Control-Allow-Origin response header.

ApsaraVideo Live also provides mobile and web demos for trying out RTS.

You can also integrate the following SDKs into your applications:

SDK type

Documentation

Mobile

Native RTS ingest and playback

Web

Web RTS ingest and playback

Note

If you encounter playback issues, first use the self-service troubleshooting tool. This tool can quickly diagnose common playback problems and provide solutions. For more information, see Self-service troubleshooting.

Verify end-to-end latency

You can add a time calibrator URL to the stream ingest to verify the latency of RTS by comparing it with the standard time. The following example uses OBS for stream ingest.

In the main OBS interface, add the time calibrator URL as a browser source in the Sources section, and then click Start Streaming.