...
2. If HLS agent for the stream is stopped by REST query /hls/terminate, and there are active HLS subscribers, this agent will be restarted. In this case, active HLS subscribers must reconnect to the stream.
HLS ABR support
Legacy HLS ABR implementation in builds 5.2.484 - 5.2.582
Since build 5.2.484 HLS ABR playlists support was added. This feature can be enabled with the following parameter
...
Code Block | ||||
---|---|---|---|---|
| ||||
curl -s http://localhost:8082/test/test.m3u8 sleep 1 curl -s http://localhost:8082/test-240p/test-240p.m3u8 sleep 1 curl -s http://localhost:8082/test-480p/test-480p.m3u8 sleep 1 curl -s http://localhost:8082/test-720p/test-720p.m3u8 sleep 1 |
Actual HLS ABR implementation in build 5.2.585 and newer
Since build 5.2.585 HLS ABR implementation is significally changed. As usual, HLS ABR can be used in CDN only, but Edge server captures all the transcoded streams for ABR manifest stream variants within the same mediasession to syhchronize the stream variants. This requires to configure Tanscoder nodes and Edge nodes simultaneously, and adds some limits. Let's explore it below.
Transcoder node settings
To synchronize all the variants of the same stream, encoding should be aligned on Transcoder node
Code Block | ||
---|---|---|
| ||
transcoder_align_encoders=true |
Also, FPS filter should be enabled
Code Block | ||
---|---|---|
| ||
video_filter_enable_fps=true
video_filter_fps=25 |
All stream variants key frames (GOPs) should be synchronized. For example, we will send key frame every 2 seconds for 25 fps stream
Code Block | ||
---|---|---|
| ||
video_filter_fps_gop_synchronization=50 |
HLS Edge node settings
HLS preloader and streams resizing should be disabled on HLS Edge node
Code Block | ||
---|---|---|
| ||
hls_preloader_enabled=false
hls_player_width=0
hls_player_height=0 |
The transcoding profiles should be set as follows in cdn_profiles.yml file
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
-240p:
audio:
codec : mpeg4-generic
rate : 48000
video:
height : 240
bitrate : 300
gop : 50
codec : h264
-480p:
video:
height : 480
bitrate : 600
gop : 50
codec : h264
-720p:
video:
height : 720
bitrate : 1000
gop : 50
codec : h264 |
Note that audio parameters can be set for the first profile only because those parameters should be identical for all the profiles, and will be applyed according to the first profile.
Then HLS ABR should be enabled
Code Block | ||
---|---|---|
| ||
hls_abr_enabled=true |
Usage
Client should request ABR manifest as usual playlist
Code Block | ||
---|---|---|
| ||
https://server:8445/test_0/test_0.m3u8 |
The playlist contains links to stream variants playlists, a client can switch between then
Code Block | ||
---|---|---|
| ||
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=614400,RESOLUTION=852x480,CODECS="avc1.42e01f,mp4a.40.2"
-480p/-480p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1024000,RESOLUTION=1278x720,CODECS="avc1.42e01f,mp4a.40.2"
-720p/-720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=307200,RESOLUTION=426x240,CODECS="avc1.42e01f,mp4a.40.2"
-240p/-240p.m3u8 |
Known limits
1. HLS Edge can be used for HLS streaming only, client sessions of another kinds will not work.
2. Stream recording, snapshots, mixing, stream capturing from another server and other captured stream management functions will not work.
3. Currently, HLS ABR segments can only be stored on disk, not in memory.
HLS segments storage
Using disk
...