This topic describes how to use Open Broadcaster Software (OBS) to ingest a Real-Time Streaming (RTS) stream based on WebRTC-HTTP Ingestion Protocol (WHIP).
Background information
WHIP is a simplified network protocol that uses HTTP POST requests to ingest real-time video streams to the cloud or other streaming media servers. WHIP is lightweight and can help easily transmit real-time video content that is captured by using Web Real-Time Communication (WebRTC) technologies to streaming media services that support the protocol. WHIP is an open-source, standardized protocol used to access WebRTC and has the advantages of low latency and good compatibility.
Preparations
Enable RTS for your domain names. Use the domain names to run the RTS demo.
For information about the differences between RTS 1.0 and RTS 2.0, see Overview.
For information about how to get started with RTS 1.0, see Get started with RTS.
For information about how to get started with RTS 2.0, see Reduce the latency to 200 to 400 ms.
Enable WHIP. This protocol is in public preview. To use WHIP, submit a ticket. For more information about how to submit a ticket, see Contact us.
Download and install OBS Studio 29.1.0 or later. Download link: OBS Studio.
Use OBS to ingest a stream
Use the URL generator in the ApsaraVideo Live console to generate an ingest URL in the RTS format. Example:
artc://al.yun.com/live/live?auth_key=******
. You can also construct an ingest URL by using the concatenation rules. For more information, see Method 2: Construct the URLs.- Log on to the ApsaraVideo Live console.
In the left-side navigation pane, choose
.Configure the parameters and obtain the ingest URL in the RTS format.
Use OBS to ingest the RTS stream.
Run OBS Studio.
In the menu bar, choose
.On the Settings page, click Stream. Configure the parameters and click OK. The following table describes the parameters.
Parameter
Description
Service
Select WHIP.
Server
Enter the ingest URL in the RTS format that is generated in Step 1. Replace the artc prefix with http or https. Example:
https://al.yun.com/live/live? auth_key=******
. If you want to use HTTPS, you must first configure a certificate. For more information, see Configure HTTPS secure acceleration.Bearer Token
Leave this parameter empty.
On the homepage of OBS Studio, click Start Streaming.
View active streams on the Stream Management page of the ApsaraVideo Live console.
In the left-side navigation pane of the ApsaraVideo Live console, click Streams.
On the Stream Management page, select the domain name that you want to query. On the Active Streams tab, enter an application name and a stream name.
Click Search. The active streams are displayed.
Play the RTS stream by using the RTS demo for web.
Access the RTS player for web.
Click the Stream Pulling tab.
Enter the streaming URL of the RTS stream.
Click Start to play the RTS stream.
Encoding
By default, a browser that supports WebRTC supports the playback of audio in the Opus format. You can use the browser to play an RTS stream without the need to transcode the stream. When you use OBS to ingest a stream, the default audio format is Opus.
RTS 1.0
If you use RTS 1.0 to ingest a stream but use standard streaming to pull the stream over a protocol such as Real Time Messaging Protocol (RTMP), Flash Video (FLV), or HTTP Live Streaming (HLS), you must configure a transcoding template for the streaming domain to transcode the audio format from Opus to Advanced Audio Coding (AAC). For more information about how to configure a transcoding template, see Transcoding management.
For example, you have a pair of associated ingest and streaming domains, rts-push.ialicdn.com
and rts-pull.ialicdn.com
, for which RTS 1.0 is enabled. If you want to pull the stream over RTMP, FLV, or HLS, you must perform the following operations:
Configure a transcoding template that transcodes the audio format from Opus to AAC for the streaming domain
rts-pull.ialicdn.com
. If another transcoding template is already configured, you do not need to configure a transcoding template that transcodes the audio format from Opus to AAC. An Alibaba Cloud transcoding template converts the audio format to AAC by default.Send a request to
rts-pull.ialicdn.com
over RTMP, FLV, or HLS to play the transcoded stream.
RTS 2.0
If you use RTS 2.0 to ingest a stream but use standard streaming to pull the stream over a protocol such as RTMP, FLV, or HLS, you must enable stream relay for the ingest domain for which RTS 2.0 is enabled, add ingest and streaming domains that are used for standard streaming, and configure a transcoding template for the streaming domain that is used for standard streaming. For more information about how to configure a transcoding template, see Transcoding management. For more information about how to enable stream relay, see Reduce the latency to 200 to 400 ms.
For example, you have a pair of associated ingest and streaming domains, rtc-push.ialicdn.com
and rtc-pull.ialicdn.com
, for which RTS 2.0 is enabled. In addition, you have another pair of associated ingest and streaming domains, rtmp-push.ialicdn.com
and rtmp-pull.ialicdn.com
, which are used for standard streaming over RTMP. If you want to pull the stream over RTMP, FLV, or HLS, you must perform the following operations:
Enable stream relay for the ingest domain
rtc-push.ialicdn.com
. In the stream relay settings, specifyrtmp-push.ialicdn.com
as the destination domain name. Use the streaming domainrtmp-pull.ialicdn.com
for playback.Configure a transcoding template that transcodes the audio format from Opus to AAC for the streaming domain
rtmp-pull.ialicdn.com
. If another transcoding template is already configured, you do not need to configure a transcoding template that transcodes the audio format from Opus to AAC. An Alibaba Cloud transcoding template converts the audio format to AAC by default.Send a request to
rtmp-pull.ialicdn.com
over RTMP, FLV, or HLS to play the transcoded stream.
MSIDs
For information about media stream IDs (MSIDs), see The Msid Mechanism.
The amsid and vmsid parameters are optional in an ingest URL. When you use RTS 2.0 to ingest a stream, you must specify
amsid
,vmsid
, or both the parameters in the ingest URL. Otherwise, the player fails to subscribe to the stream.If you want to use RTS 2.0 to play a stream in ApsaraVideo Player, you need to set the value of amsid to
rts audio
and the value of vmsid torts video
in the ingest URL. For more information, see Specifications of the RTS signaling protocol.OBS supports the ingest of audio-only and video-only streams. For an audio-only stream, you need to only specify the amsid parameter. For a video-only stream, you need to only specify the vmsid parameter.
The following examples show ingest URLs that do not include the amsid and vmsid parameters and an ingest URL that includes the amsid and vmsid parameters.
http://push-test.alicdn.com/app/name
https://push-test.alicdn.com/app/name
https://push-test.alicdn.com/app/name?amsid=rts%20audio&vmsid=rts%20video
In an ingest URL, you must escape special characters including spaces. In this case, the space " "
in the value rts video
is escaped as "%20"
.