All Products
Search
Document Center

ApsaraVideo Live:Configure encapsulation

Last Updated:Mar 20, 2024

ApsaraVideo Live supports multiple streaming protocols such as Real-Time Messaging Protocol (RTMP), HTTP-FLV, and HTTP Live Streaming (HLS). To reduce latency and enhance compatibility, ApsaraVideo Live provides the live stream encapsulation feature to support additional streaming protocols such as Low-Latency HTTP Live Streaming (LL-HLS) and segment formats such as Common Media Application Format (CMAF). This topic describes how to configure live stream encapsulation in the ApsaraVideo Live console.

Overview

After you enable the live stream encapsulation feature, a live stream is sliced into Transport Stream (TS) or CMAF segments. These segments are distributed to viewers over the HLS or LL-HLS protocol, and the corresponding URLs in the M3U8 playlist are constantly updated. Compared with HLS, LL-HLS can further divide these segments into smaller parts (with a duration of 200 milliseconds to 1 second) and block playlist reloads, which reduces the end-to-end latency to 3 to 5 seconds.

Usage notes

Make sure that the group of pictures (GOP) size of the live stream is stable and that the segment length is equal to or an integer multiple of the GOP size. If you specify that the encapsulation settings take effect for the transcoded stream, you must also ensure that the GOP size of the transcoded stream is stable. If you use LL-HLS, take note of the following points:

  • We recommend that you use live stream encapsulation together with multi-bitrate transcoding. This way, the bitrate can be automatically adjusted in poor network conditions to reduce stuttering.

  • Make sure that the GOP size of the live stream is fixed at 1 second or 2 seconds. Otherwise, stuttering occurs or playback fails.

  • You must use a player that supports LL-HLS, such as ApsaraVideo Player, HLS.js, or ExoPlayer. We recommend that you use ApsaraVideo Player.

  • A main streaming domain supports up to 100,000 viewers. If you want to increase the quota, submit a ticket.

  • The first time you configure encapsulation for a domain name, domain acceleration is automatically configured and takes effect in 3 minutes to 5 minutes.

Procedure

  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 streaming domain that you want to configure and click Domain Settings in the Actions column.

    001

  4. Choose Templates > Encapsulation Settings. On the page that appears, click Add. The following table describes the parameters that you can configure.

    Parameter

    Description

    APPName

    • The name must be the same as the application name that is specified in the ingest URL. Otherwise, the encapsulation settings do not take effect.

    • The name can be up to 256 characters in length and can contain digits, letters, hyphens (-), and underscores (_).

    • You can also set this parameter to an asterisk (*) to specify any string, including an empty string.

    StreamName

    • The name must be the same as the stream name that is specified in the ingest URL. Otherwise, the encapsulation settings do not take effect.

    • The name can be up to 256 characters in length and can contain digits, letters, hyphens (-), and underscores (_).

    • You can also set this parameter to an asterisk (*) to specify any string, including an empty string.

    Protocol

    The protocol that is used to encapsulate the stream. Valid values:

    • HLS - CMAF

    • LL-HLS - CMAF

    • LL-HLS - TS

    Segment Quantity

    The number of segments. You can enter an integer from 3 to 5.

    Segment Length

    • Valid values if you set the Protocol parameter to HLS - CMAF: integers from 1 to 10. Unit: seconds. The GOP size is a fixed value. We recommend that you set the GOP size to 5 seconds. Make sure that the segment length is an integer multiple of the GOP size.

    • Valid values if you set the Protocol parameter to LL-HLS - CMAF or LL-HLS - TS: integers from 1 to 10. Unit: seconds. The GOP size is a fixed value. We recommend that you set the GOP size to 1 second. Make sure that the segment length is an integer multiple of the GOP size.

    Part Length

    This parameter is required only if you set the Protocol parameter to LL-HLS - CMAF or LL-HLS TS. Valid values: integers from 200 to 1000. Unit: milliseconds. We recommend that you specify a part length that is slightly more than one third of the segment length.

    Transcoded Stream

    Valid values: Source Stream Only and Transcoded Stream Included.

    Note
    • If the time shifting feature is configured for the same stream in the same application, the segment length and protocol that are specified in the encapsulation settings apply to time shifting.

    • If multi-bitrate transcoding is configured for the same stream in the same application, the segment length and protocol that are specified in the encapsulation settings apply to multi-bitrate transcoding.

    • If the streaming domain resides in a region outside China, including Singapore, Germany (Frankfurt), Japan (Tokyo), India (Mumbai), and Indonesia (Jakarta), you may encounter high latency issues. We recommend that you test and verify whether the settings meet expectations.

  5. Click OK.

API references

Live stream encapsulation