HLS
After completing your MSL5: HLS Ingest setup, configure your encoder to capture and push your stream to the entry points.
To prevent stream vulnerability to potential network problems, you must actively use both primary and backup streams. This adds redundancy by implementing an automatic failover feature should one stream or the other fail. The easiest way to use primary/backup streams is to set them up in a single encoder. Not all third-party encoders support this, however, and with those it becomes necessary to use separate encoders to stream primary and backup.
While primary/backup streaming is possible with dual encoders, it is not automated and requires certain manual steps to enable it. With typical single encoder primary/backup functionality, the encoder automatically creates a variant playlist that includes all primary and backup bitrates. This ensures that the primary and backup streams are always aware of each other's existence and allows for automatic failover from one to the other. With situations that require dual encoders, this automatic playlist generation does not occur. Here, each encoder creates variant playlists for the primary or backup stream only, requiring manual manipulation to create a merged playlist that includes both primary and backup streams.
In addition, there might be circumstances where you need dual encoders in two separate geographical locations, with one streaming the primary and the other streaming the backup. In this case, even encoders that support primary/backup from a single encoder will require the dual encoder solution with regard to variant playlist generation.
HLS Publishing URL
The encoder publishes primary and backup streams for the HLS protocol according to the following URL syntax.
Stream | Hostname | Path | Example |
---|---|---|---|
Primary | p-ep{stream_id}.i.harmonicincentrypoint.net | {stream_id}/{event_name} | http(s)://p-ep50002.i.harmonicincentrypoint.net/9dbd53ba-ac76-45a1-9581-a4c1737f85c5/event1/master.m3u8 |
Backup | b-ep{stream_id}.i.harmonicincentrypoint.net | {stream_id}-b/{event_name} | http(s)://b-ep50002.i.harmonicincentrypoint.net/9dbd53ba-ac76-45a1-9581-a4c1737f85c5-b/event1/master.m3u8 |
The MSL5 system defines a stream as a combination of stream_id
and event_name
. All ingested content, such as variant playlists, bitrate playlists, and segments, should have a common event_name
in the path.
In Backup URLs, note the -b
in the path.
HLS Playback URL
To playback HLS streams, construct the URL according to the following syntax.
The following URLs are used for playback. The {stream_id}
and {event_name}
placeholders correspond to the stream's configuration.
Stream | Path | Example |
---|---|---|
Primary | hls/live/{stream_id}/{event_name}/{filename}.m3u8 | http(s)://origin.harmonicinczed.net/hls/live/9dbd53ba-ac76-45a1-9581-a4c1737f85c5/event_1/index.m3u8 |
Backup | hls/live/{stream_id}-b/{event_name}/{filename}.m3u8 | http(s)://origin.harmonicinczed.net/hls/live/9dbd53ba-ac76-45a1-9581-a4c1737f85c5-b/event_1/index.m3u8 |
In Backup URLs, note the -b
in the path.
Create a merged variant playlist
To create a merged playlist, you must extract the variant playlists from each encoder and manually merge them. For example, assume a primary variant playlist URL of:
http://origin.akamaized.net/hls/live/50002/event/master.m3u8
Start your encoder, and then use the UNIX curl
command to acquire the variant playlist's contents.
curl http://origin.akamaized.net/hls/live/50002/event/master.m3u8
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
http://origin.akamaized.net/hls/live/50002/event/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
http://origin.akamaized.net/hls/live/50002/event/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
http://origin.akamaized.net/hls/live/50002/event/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
http://origin.akamaized.net/hls/live/50002/event/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
http://origin.akamaized.net/hls/live/50002/event/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
http://origin.akamaized.net/hls/live/50002/event/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
http://origin.akamaized.net/hls/live/50002/event/iphone110audio.m3u8
Notice that each line denotes a different bitrate.
Now, do the same for the backup variant playlist URL:
http://origin.akamaized.net/hls/live/50002-b/event/master.m3u8
curl http://origin.akamaized.net/hls/live/50002-b/event/master.m3u8
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
http://origin.akamaized.net/hls/live/50002-b/event/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
http://origin.akamaized.net/hls/live/50002-b/event/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
http://origin.akamaized.net/hls/live/50002-b/event/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
http://origin.akamaized.net/hls/live/50002-b/event/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
http://origin.akamaized.net/hls/live/50002-b/event/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
http://origin.akamaized.net/hls/live/50002-b/event/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
http://origin.akamaized.net/hls/live/50002-b/event/iphone110audio.m3u8
Manually merge the contents of each of these files to produce the following:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
http://origin.akamaized.net/hls/live/50002/event/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=165135
http://origin.akamaized.net/hls/live/50002-b/event/iphone110.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
http://origin.akamaized.net/hls/live/50002/event/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=262346
http://origin.akamaized.net/hls/live/50002-b/event/iphone200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
http://origin.akamaized.net/hls/live/50002/event/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=481677
http://origin.akamaized.net/hls/live/50002-b/event/iphone400.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
http://origin.akamaized.net/hls/live/50002/event/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=688301
http://origin.akamaized.net/hls/live/50002-b/event/ipad600.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
http://origin.akamaized.net/hls/live/50002/event/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=894877
http://origin.akamaized.net/hls/live/50002-b/event/ipad800.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
http://origin.akamaized.net/hls/live/50002/event/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=1308077
http://origin.akamaized.net/hls/live/50002-b/event/ipad1200.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
http://origin.akamaized.net/hls/live/50002/event/iphone110audio.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000
http://origin.akamaized.net/hls/live/50002-b/event/iphone110audio.m3u8
Notice that each bitrate in the list has a primary and a backup associated with it.
Finally, use the curl
command to post the file to the primary ingress URL.
curl -T master.m3u8 http://p-ep50002.i.akamaientrypoint.net/50002/event/index.m3u8
As shown in the
curl
upload example, ensure that the merged variant playlist name is different from existing playlist names so that it is not overwritten. For example, ifmaster.m3u8
is used by your primary and backup, you can rename the merged playlist toindex.m3u8
orplaylist.m3u8
. Ifmaster.m3u8
is used by your primary andplaylist.m3u8
is used by your backup, you could rename the merged playlist toindex.m3u8
.
Updated about 1 month ago