All Products
Search
Document Center

ApsaraVideo Live:Get started with ApsaraVideo Live

Last Updated:Mar 01, 2024

This topic describes how to use ApsaraVideo Live to stream live.

Prerequisites

  • An Alibaba Cloud account is created and real-name verification is complete. To create an Alibaba Cloud account, visit the Alibaba Cloud official website. For more information, see Create an Alibaba Cloud account.

  • An ingest domain and a streaming domain are available. ICP filing for the domain names is complete. For more information, see What is an ICP filing?.

    Note
    • If you are in a live center outside the Chinese mainland and set Acceleration Region to Outside Chinese Mainland for the domain names, ICP filing is not required.

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

Basic 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 custom URL signing

  6. Generate ingest and streaming URLs

  7. Live stream ingest

  8. Live stream playback

Activate ApsaraVideo Live

Note

You can view the tutorial video to learn how to activate ApsaraVideo Live. For more information, see Activate ApsaraVideo Live.

  1. Log on to the Alibaba Cloud official website. In the top navigation bar, choose Products > Media Services > 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.

Add an ingest domain and a streaming domain

To use ApsaraVideo Live services, you must add an ingest domain and a streaming domain.

Note

You can view the tutorial video to learn how to add a domain name. For more information, see Add a domain name.

  1. Log on to the ApsaraVideo Live console.

  2. In the left-side navigation pane, click Domains. The Domain Management page appears.

  3. Click Add Domain.

  4. Configure the domain name based on your business requirements.

    配置域名

    Parameter

    Option

    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 set.

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

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

    Domain Name

    N/A

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

    • 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 subdomain, ApsaraVideo Live verifies the ownership of the subdomain. If the subdomain 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 How do I select the acceleration region for a domain name? .

    Live Center

    N/A

    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 set.

    For more information about how to select a live center, see How do I select a live center? .

  5. Click Next.

Add CNAME records

To enable acceleration for ApsaraVideo Live, you must add CNAME records at your DNS service provider to map your ingest domain and streaming domain to the CNAME that is assigned by ApsaraVideo Live. The following example shows how to add a CNAME record when your DNS service provider is Alibaba Cloud. For information about how to add a CNAME record at other DNS service providers, see Add a CNAME record.

Note
  • You can view the tutorial video to learn how to add a CNAME record. For more information, see Add a CNAME record.

  • 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.

To check whether a CNAME record takes effect, 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 is in effect. For more information, see Check whether the DNS records take effect.image

Associate the streaming domain with the ingest domain

ApsaraVideo Live uses the edge ingest method. To ingest and play streams, you must associate the streaming domain with the ingest domain.

Note

You can view 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. On the Domain Management page, find the streaming domain that you added and click Domain Settings in the Actions column. The Streaming Management > Basic Settings page appears.

  2. Click the Basic Information tab.

    On this tab, you can view the CNAME, Added At, Domain Type, Live Center, Edge Group, and Quota Limits information. Basic Information

    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 centers, submit a ticket. For more information, see Contact us.

    • For more information about quota limits, see Manage ApsaraVideo Live quotas.

    • For more information about how to change the edge group, see Change the edge group.

  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 custom URL signing

The URL signing feature can be used to protect resources on origin servers from unauthorized access and downloads. By default, URL signing is enabled for a domain name that you add.

You can use the default URL signing settings or custom URL signing settings based on your business requirements. If you use the default URL signing settings, no additional configuration is required. If you do not want to use the default settings, you can specify the Primary Key, Secondary Key, and Validity Period parameters.

If you disable URL signing for the first time, make sure that you understand the risks related to unauthorized usage of your service and agree to the Terms for Disabling URL Signing. By default, URL signing is enabled. We recommend that you keep this feature enabled to prevent illegal recording and distribution.

Note

You can view the tutorial video to learn how to configure URL signing. For more information, see Configure URL signing.

  1. On the Domains page, find the streaming domain that you added and click Domain Settings in the Actions column.

  2. Choose Streaming Management > Access Control. The Access Control page appears.

  3. Click the URL Signing tab. Then, click Change Settings.

    Note

    When URL signing is enabled, you can click Change Settings to modify the URL signing settings. When URL signing is disabled, you can turn on URL Signing and then configure the URL signing settings.

  4. Configure the URL signing settings.

    The following table describes the parameters.

    Parameter

    Description

    Authentication Type

    ApsaraVideo Live streaming domains support only the authentication type of Type A 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 for the domain name. To view the primary key, click Domains in the left-side navigation pane of the ApsaraVideo Live console. On the Domain Management page, find the domain name and click Domain Settings in the Actions column. On the page that appears, choose Streaming Management > Access Control. Then, view the primary key on the URL Signing tab. You can also change the primary key.

    Secondary Key

    Specify a custom secondary key.

    Validity Period

    Signed URLs 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 were 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 of signed URLs under a domain name that you add is 1 day or 1,440 minutes. You can specify a custom validity period for signed URLs. The minimum value is 1 minute. There is no upper limit.

Generate ingest and streaming URLs

Ingest and streaming URLs are used to ingest and play streams. You can use one of the following methods to generate ingest and streaming URLs.

Method 1: Generate the URLs in the console

You can use the live URL generator in the ApsaraVideo Live console to generate ingest and streaming URLs. For more information, see Live URL generator.

Method 2: Construct the URLs

Before you construct an ingest URL or a streaming URL by using the concatenation rules, confirm whether the live stream requires transcoding and URL signing. Then, obtain the ingest domain, streaming domain, application name, stream name, transcoding template ID, and access token. The transcoding template ID and access token are optional. The following table describes the concatenation rules.

URL type

Concatenation rule

Sample URL

Ingest URL

Ingest domain + Application name + Stream name + Access token

  • Ingest URL in the RTMP format: rtmp://demo.aliyundoc.com/app/stream?auth_key={Access token}

  • Ingest URL in the RTS format: artc://demo.aliyundoc.com/app/stream?auth_key={Access token}

  • Ingest URL in the SRT format: srt://demo.aliyundoc.com:1105?streamid=#!::h=demo.aliyundoc.com,r=/app/stream?auth_key={Access token},m=publish

    Note

    Take note that m=publish is not included in the access token of an ingest URL in the SRT format. Example: srt://demo.aliyunlive.com:1105?streamid=#!::h=demo.aliyunlive.com,r=/1/1?auth_key=1661312655-0-0-3fded78b61b14071****aa6e6d2,m=publish.

Streaming URL

Streaming domain + Application name + Stream name + Access token

  • Streaming URL in the RTMP format: rtmp://example.aliyundoc.com/app/stream?auth_key={Access token}

  • Streaming URL in the FLV format: http://example.aliyundoc.com/app/stream.flv?auth_key={Access token}

  • Streaming URL in the M3U8 format: http://example.aliyundoc.com/app/stream.m3u8?auth_key={Access token}

  • Streaming URL in the RTS format: artc://example.aliyundoc.com/app/stream?auth_key={Access token}

Transcoded stream URL

Streaming domain + Application name + Stream name_Transcoding template ID + Access token

To transcode a stream, you must add _Transcoding template ID after the stream name.

  • Transcoded stream URL in the RTMP format: rtmp://example.aliyundoc.com/app/stream_{Transcoding template ID}?auth_key={Access token}

  • Transcoded stream URL in the FLV format: http://example.aliyundoc.com/app/stream_{Transcoding template ID}.flv?auth_key={Access token}

  • Transcoded stream URL in the M3U8 format: http://example.aliyundoc.com/app/stream_{Transcoding template ID}.m3u8?auth_key={Access token}

  • Transcoded stream URL in the RTS format: artc://example.aliyundoc.com/app/stream_{Transcoding template ID}?auth_key={Access token}

URL for delayed streaming

Streaming domain + Application name + Stream name-alidelay + Access token

You must add -alidelay after the stream name in a URL for delayed streaming.

  • URL for delayed streaming in the RTMP format: rtmp://example.aliyundoc.com/app/stream-alidelay?auth_key={Access token}

  • URL for delayed streaming in the FLV format: http://example.aliyundoc.com/app/stream-alidelay.flv?auth_key={Access token}

  • URL for delayed streaming in the M3U8 format: http://example.aliyundoc.com/app/stream-alidelay.m3u8?auth_key={Access token}

  • URL for delayed streaming in the RTS format: artc://example.aliyundoc.com/app/stream-alidelay?auth_key={Access token}

Note
  • Before you use a URL in the Real-Time Streaming (RTS) format, you must enable the RTS feature. For more information, see Enable RTS.

  • ApsaraVideo Live determines whether a stream is unique based on the stream name instead of the application name. If you specify a unique application name, you must also specify a unique stream name to ensure that the stream is unique. If you want applications with different application names under a domain name to ingest the same stream, contact us to enable the application isolation feature.

  • If you use a transcoding template or enable URL signing, replace the content in braces {} with the actual value. An access token is an encrypted string that is generated based on the URL signing algorithm. You must enable the URL signing feature to generate an access token. You can enable the URL signing feature in the ApsaraVideo Live console and obtain the access token. For more information, see Configure URL signing. You can also use the MD5 algorithm to generate the access token. For more information, see Construct a signed URL.

  • If you need to only pull streams, the ingest domain is not required.

  • You must provide a transcoding template ID to generate a transcoded stream URL. You can specify or view the ID of a transcoding template in the ApsaraVideo Live console. For more information, see Configure default transcoding. You can also call the AddCustomLiveStreamTranscode or DescribeLiveStreamTranscodeInfo operation to specify or obtain the ID of a transcoding template.

  • A URL for delayed streaming can take effect only after you configure stream delay. You can configure this feature in the ApsaraVideo Live console. For more information, see Configure stream delay. If stream delay is not configured for the streaming domain or live streaming has not started, the URL for delayed streaming cannot be pulled.

Live stream ingest

Live stream ingest is the process of delivering the collected audio and video streams to a live center of ApsaraVideo Live. The following steps provide an example on how to ingest a stream by using OBS Studio. For information about how to use other stream ingest tools to ingest a stream, see Live stream ingest.

Note

You can view the tutorial video to learn how to ingest a stream. For more information, see Stream ingest and playback.

  1. Download and install OBS Studio. Download link: OBS Studio.

  2. Run OBS Studio.

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

  4. On the Settings page, click Stream and configure the following parameters.

    001

    Parameter

    Description

    Service

    Select Custom....

    Server

    Enter the generated ingest URL that is signed. Example: rtmp://demo.aliyundoc.com/app/stream?auth_key=1543302081-0-0-9c6e7c8190c10bdfb3c0************.

    Stream Key

    Leave this parameter empty.

  5. Go to the homepage of OBS Studio. Find the Sources section, add a source, and then click Start Streaming.

    002

  6. (Optional) Install the Queen SDK plug-in for OBS to debug retouching effects. For more information, see User guide to the Queen SDK plug-in for OBS.

Note

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.

Live stream playback

Live stream playback is the process of delivering a live stream from a live center of ApsaraVideo Live to a player for playback. The following steps provide an example on how to play a stream by using VLC media player. For information about how to use other players to play a stream, see Live stream playback.

Note

You can view the tutorial video to learn how to play a stream. For more information, see Stream ingest and playback.

  1. Download and install VLC media player. Download link: VLC media player.

  2. Run VLC media player.

  3. In the menu bar, choose Media > Open Network Stream....

  4. On the Network tab, enter a network URL, that is, a streaming URL. Example: rtmp://example.aliyundoc.com/app/stream?auth_key=1543300311-0-0-d47ce016332bf280cf275********.

  5. Click Play.

Note

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 features

ApsaraVideo Live provides various features, such as permission management, basic services, streaming acceleration, streaming security, streaming latency control, HTTP configuration, media processing for live streams, streaming management, statistics, and log management. For more information about how to use the preceding features, see Overview.