This topic explains how to use ApsaraVideo Live to push and play back streams using the Enhanced-RTMP protocol.
What is Enhanced-RTMP
Enhanced-RTMP is an extension of the traditional RTMP protocol that overcomes its limitation of supporting only H.264 encoding. Unlike earlier proprietary solutions that used custom CodecIDs, Enhanced-RTMP is a standard protocol developed by the global open-source community. Mainstream tools such as FFmpeg 6.1+ and OBS Studio 29+ support it, offering better compatibility and extensibility.
Enhanced-RTMP allows you to use next-generation encoding formats such as H.265 (HEVC) and AV1 for live stream push and playback. For the protocol specifications, see the Enhanced-RTMP Specification.
Alibaba Cloud support
ApsaraVideo Live fully supports the Enhanced-RTMP protocol:
-
Ingest client: Stream push with H.265 (HEVC) and AV1 encoding is fully supported by default.
-
Playback client: Supports stream pull for content encoded with H.265 (HEVC) and AV1. To enable this feature, you must contact Alibaba Cloud sales.
-
Ingest tool: You can use OBS Studio 29+ and FFmpeg 6.1+ directly.
-
The VP9 encoding format is not currently supported.
-
For audio encoding, only the AAC format is supported.
Prerequisites
Before you can use Enhanced-RTMP for stream push and playback, you must:
-
Activate ApsaraVideo Live and configure an ingest domain and a streaming domain.
-
Prepare an ingest tool that supports Enhanced-RTMP, such as OBS Studio 29+ or FFmpeg 6.1+.
Use OBS Studio for stream push
OBS Studio has supported the Enhanced-RTMP protocol since version 29. This section describes how to use OBS Studio to push a live stream in H.265 or AV1 format to ApsaraVideo Live. For more information, see the official OBS Studio project.
Step 1: Configure the video encoder
Open OBS Studio and go to Settings > Output.
Set Rate Control to CBR and Preset to Okay (8).
Set Output mode to Advanced and configure the following parameters:
-
Video Encoder: Select
HEVC (H.265)orAV1based on your requirements. -
Keyframe Interval: We recommend setting this to
1second. Do not set it to 0. -
Bitrate: Set this based on your network bandwidth and desired video quality. H.265 encoding can reduce the bitrate by approximately 30% to 50% compared to H.264.
Step 2: Configure the ingest URL
In OBS Studio, go to Settings > Stream and configure the ingest URL:
-
Service: Select Custom...
-
Server: Enter
rtmp://your-ingest-domain/AppName/StreamName?auth_key=xxx
Step 3: Start streaming
Once configured, click Start Streaming on the main OBS Studio interface to push the H.265 or AV1 video stream to ApsaraVideo Live.
You can view the stream status and bitrate information on the Stream Management page in the ApsaraVideo Live console.
Use FFmpeg for stream push
FFmpeg is a powerful command-line tool for audio and video processing. It has supported the Enhanced-RTMP protocol since version 6.1. The following command shows how to push an H.265 live stream using FFmpeg. For more information, see the official FFmpeg project.
Push a local video file
ffmpeg -re -i input.mp4 \
-c:v libx265 \
-preset fast \
-b:v 2000k \
-g 30 \
-c:a aac \
-b:a 128k \
-f flv \
"rtmp://your-ingest-domain/AppName/StreamName?auth_key=xxx"
Parameter descriptions:
-
-re: Reads the input file at its native frame rate to simulate a live stream. -
-c:v libx265: Specifies the H.265 encoder. -
-preset fast: Sets the encoding speed preset. Valid values include ultrafast, fast, medium, and slow. -
-b:v 2000k: Sets the video bitrate to 2 Mbps. -
-g 30: Sets the keyframe interval (GOP). We recommend setting this value to 1 to 2 times the frame rate.
Pushing a stream with AV1 encoding
To use the AV1 encoding format, change the encoder parameters as follows:
ffmpeg -re -i input.mp4 \
-c:v libsvtav1 \
-preset 8 \
-b:v 1500k \
-g 30 \
-c:a aac \
-b:a 128k \
-f flv \
"rtmp://your-ingest-domain/AppName/StreamName?auth_key=xxx"
Enhanced-RTMP playback
ApsaraVideo Live supports Enhanced-RTMP stream pull for live content encoded in H.265 and AV1.
To enable Enhanced-RTMP playback, contact Alibaba Cloud sales.
Playback URL format
To play a live stream over Enhanced-RTMP, add a specific parameter to the playback URL:
RTMP playback:
rtmp://your-streaming-domain/AppName/StreamName?is_enhanced_rtmp_play=on
HTTP-FLV playback:
http://your-streaming-domain/AppName/StreamName.flv?is_enhanced_rtmp_flv_play=on
-
If you omit the
is_enhanced_rtmp_playoris_enhanced_rtmp_flv_playparameter, the stream defaults to a format that uses custom CodecIDs. In this format, H.265 corresponds tocodec_id=12and AV1 corresponds tocodec_id=13. -
We recommend using the Enhanced-RTMP format for better compatibility and future extensibility.