A common problem with live streaming is that the audience with poor network conditions cannot play a live video though the ingest stream bitrate is set fairly high with a high resolution. To resolve this issue, we can use the live encoding feature to convert live streams into different bitrates to satisfy the needs of users under different network conditions.

Architecture

Encoding rules

The encoding service of ApsaraVideo Live is designed in a way similar to that of the recording service. The encoding service encodes live streams matching your specified ingest domain and application name.

Encoding settings

Each encoding setting has an ID and contains a set of encoding parameters, including the bitrate and resolution of the encoded streams.

ApsaraVideo provides two groups of encoding settings: high-quality and low-quality encoding settings. Each group has four different resolution and bitrate combinations. The settings are as follows:

  • High-quality encoding settings: ld, sd, hd, and ud
  • Low-quality encoding settings: lld, lsd, lhd, and lud

Encoding configuration rules

The ingest URL is in the following format:

rtmp://video-center.alivecdn.com/AppName/StreamName? vhost=a.com

Three parts of this ingest URL are user-defined: domain name (a.com), AppName, and StreamName. You can configure certain encoding settings for the specified domain name and AppName. The streams that match the domain name and AppName are then encoded when you are ingesting streams.

Examples

Set the domain name to a.com and AppName to live. The following live streams are encoded:

rtmp://video-center.alivecdn.com/live/StreamName? vhost=a.com

rtmp://video-center.alivecdn.com/live/xyz? vhost=a.com

You can configure the Configure default transcoding and custom encoding in the ApsaraVideo Live console.

The streaming URL of an encoded stream is in the following format: streaming URL of the original stream+_+ encoding setting ID. Assume that you configure the encoding settings ld and sd for the domain name a.com and application name live. The ingest URL and streaming URLs before and after encoding are as follows:

  • Ingest URL: rtmp://video-center.alivecdn.com/live/abc? vhost=a.com

  • Streaming URLs of the original stream:

    • RTMP: rtmp://a.com/live/abc

    • HTTP-FLV: http://a.com/live/abc.flv

    • HLS: http://a.com/live/abc.m3u8

  • Streaming URLs of the encoded stream with the encoding setting ld:

    • RTMP: rtmp://a.com/live/abc_ld

    • HTTP-FLV: http://a.com/live/abc_ld.flv

    • HLS: http://a.com/live/abc_ld.m3u8

  • Streaming URLs of the encoded stream with the encoding setting sd:

    • RTMP: rtmp://a.com/live/abc_sd

    • HTTP-FLV: http://a.com/live/abc_sd.flv

    • HLS: http://a.com/live/abc_sd.m3u8

For more information, see Ingest and streaming URLs.