You can smoothly upgrade from standard streaming to Real-Time Streaming (RTS). If you are using standard streaming, you can enable RTS and then use standard streaming and RTS at the same time. This topic describes how to switch from standard streaming to RTS.
Prerequisites
ApsaraVideo Live is activated and standard streaming is configured. For more information about how to configure standard streaming, see Get started with ApsaraVideo Live. To use standard streaming, perform the following steps:
Step 1: Enable RTS
From September 1, 2022, RTS and auto transcoding for HTML5 playback are automatically enabled for streaming domains that you add. No additional configurations are required. For streaming domains that were added before September 1, 2022, you must manually configure the settings.
Log on to the ApsaraVideo Live console.
In the left-side navigation pane, click Domain Names. The Domain Management page appears.
Find the streaming domain for which you want to enable RTS and click Domain Settings in the Actions column.
On the page that appears, choose .
Turn on RTS.
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, the feature of auto transcoding for HTML5 playback 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, both the feature of auto transcoding for HTML5 playback and the transcoding template take effect. The transcoding is billed only once.
If you use Native RTS SDK to play a stream, transcoding is not required because the SDK supports B-frames and the AAC audio format.
NoteWait a few minutes and then check whether the configurations for RTS take effect.
To map an ingest domain to multiple streaming domains, you must bind one or more sub-streaming domains to a main streaming domain. For more information, 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 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 domain and the streaming domain. For more information, see Configure HTTPS secure acceleration.
If you use RTS SDK or the RTS demo, SSL certificates are not required.
Step 2: Generate an ingest URL and a streaming URL for RTS
You can generate an ingest URL and a streaming URL by using the ApsaraVideo Live console or construct the URLs by using the concatenation rules.
Method 1: Generate the URLs by using the console
If you want to quickly generate ingest and streaming URLs, use the URL generator in the console. For more information, see Live URL generator.
Method 2: Construct the URLs
Before you construct an ingest URL or a streaming URL for a live stream by using the concatenation rules, check whether the stream is transcoded and authenticated. Then, obtain an ingest domain, a streaming domain, an application name, a stream name, a transcoding template ID, and an access token. The transcoding template ID and access token are optional. The following table describes the concatenation rules.
URL type | URL format | Concatenation rule |
Ingest URL | The Real-Time Messaging Protocol (RTMP), RTS, and Secure Reliable Transport (SRT) formats are supported. We recommend that you use the RTMP format. Example: Ingest URL in the RTMP format: Note RTS allows you to pull streams over RTS. | Ingest domain + Application name + Stream name + Access token |
Streaming URL | The RTMP, Flash Video (FLV), M3U8, and RTS formats are supported. We recommend that you use the RTS format. Example: Streaming URL in the RTS format: | 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. The transcoded stream URL is required only if a transcoding template is used. | The RTMP, FLV, M3U8, and RTS formats are supported. We recommend that you use the RTS format. Example: Transcoded stream URL in the RTS format: artc://example.aliyundoc.com/app/stream_{Transcoding template ID}?auth_key={Access token} | Streaming domain + Application name + Stream name_Transcoding template ID + Access token |
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 Construct a signed URL.
When you construct a URL by using the concatenation rules, replace {Transcoding template ID} or {Access token} with the actual value without {}.
Step 3: 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. For more information about how to ingest streams over RTS, see Stream ingest for RTS.
Download and install OBS Studio. Download link: OBS Studio.
Run OBS Studio.
In the menu bar, choose .
On the Settings page, click Stream and configure the following parameters.
Parameter
Description
Service
Select Custom....
Server
Enter the signed ingest URL that is generated. Example:
rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************
.Stream Key
Leave this parameter empty.
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
CPU Usage Preset (higher = less CPU): veryfast
Profile: baseline
Tune: zerolatency
Go to the homepage of OBS Studio. Find the Sources section, add a source, and click Start Streaming.
If you encounter issues such as stream ingest 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 for you to resolve specific exceptions. For more information, see Troubleshooting.
Step 4: 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.
Players:
Player
References
ApsaraVideo Player for mobile clients
Third-party players that are based on FFmpeg
Integrate Native RTS SDK with a third-party player that is based on FFmpeg
ApsaraVideo Player for Web
For information about the RTS demo, see Play an RTS stream.
If you encounter issues such as 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 for you to resolve specific exceptions. For more information, see Troubleshooting.
Other operations: 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. OBS Studio is used in this example.
Go to the homepage of OBS Studio. Add a time calibrator URL in the Sources section, and click Start Streaming.