All Products
Search
Document Center

ApsaraVideo Live:Use Push SDK to ingest streams over RTS

Last Updated:Dec 28, 2023

To improve the stream ingest effect of ApsaraVideo Live in poor network conditions, Push SDK adds support for stream ingest over the Real-Time Streaming (RTS) protocol that is based on Real-Time Communication (RTC). This topic compares the Real-Time Messaging Protocol (RTMP) protocol and RTS protocol for stream ingest in different network conditions. Compared with RTMP, RTS is more stable and performs better in poor network conditions. We recommend that you ingest streams over RTS. Push SDK provides a mechanism of automatic protocol degradation. If an error occurs when you ingest a stream over RTS, RTMP is used for stream ingest.

Comparison of RTMP and RTS for stream ingest in normal and poor network conditions

Testing scenario

The streamer uses Push SDK to ingest a stream, and viewers pull the stream from Alibaba Cloud points of presence (POPs). Various network restrictions are placed on the streamer side to observe the playback effect on the viewer side. The restrictions affect only the upstream bandwidth of the streamer, but not the downstream bandwidth of the streamer.

Stream ingest parameters

The same stream ingest parameters are used for RTMP and RTS.

Parameter

Value

Resolution

720 × 1280

Frame rate

20 frames per second (FPS)

Bitrate

2 Mbit/s

Network restrictions

Restriction

Description

Upstream packet loss: 20%

Two of 10 packets sent upstream are lost.

Upstream bandwidth: 500 Kbit/s

Up to 500 KB of data can be sent per second.

Upstream latency: 500 ms

Data packets are sent over the network at a latency of 500 milliseconds.

Video stuttering rate

The following graph shows the video stuttering rates in different network conditions. A greater value indicates a higher stuttering rate. As you can see from the graph, RTS has a lower stuttering rate than RTMP in poor network conditions.

视频卡顿率

Video quality

The following graph shows the video qualities in different network conditions. A greater value indicates a higher video quality. As you can see from the graph, RTS has a better video quality than RTMP in poor network conditions.

视频画质

Use Push SDK to ingest a stream over RTS

Prerequisites

  • ApsaraVideo Live is activated. An ingest domain and a streaming domain are added, and the ingest domain is associated with the streaming domain. For more information, see Basic procedure.

  • RTS-based stream ingest is enabled for the ingest domain. From September 1, 2022, RTS-based stream ingest is automatically enabled for ingest domains that you add. No additional configurations are required. For ingest 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 Domains. The Domain Management page appears.

    3. Find the ingest domain and click Domain Settings in the Actions column.

    4. On the page that appears, choose Streaming Management > RTS-based Stream Ingest.

    5. Turn on RTS-based Stream Ingest.

    RTS推流

  • An ingest URL is generated. The rules for generating ingest URLs in the RTS format are similar to the rules for generating ingest URLs in the RTMP format, except that the schemes at the beginning are different. Ingest URLs in the RTS format must start with artc://. For more information, see Generate ingest and streaming URLs.

Ingest a stream over RTS

The procedure for using Push SDK to ingest an RTS stream is similar to the procedure for using Push SDK to ingest an RTMP stream. To ingest an RTS stream, you must specify an ingest URL in the RTS format when you call the startPush method. Other settings are the same. For more information, see Use Push SDK for Android or Use Push SDK for iOS.

Important

Only audio and video streams are supported for stream ingest over RTS. In other words, an RTS stream must include both audio and video data. If you are ingesting an audio-only or video-only stream, you must add video data to the audio-only stream or audio data to the video-only stream before you can ingest the stream over RTS.

Play the stream

The RTMP, Flash Video (FLV), or HTTP Live Streaming (HLS) protocol can be used to play the RTS stream. You can also use the Alibaba Real-Time Communication (ARTC) protocol to perform RTS playback. For more information about RTS playback, see Start RTS playback.