Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Since build 5.2.484 HLS ABR playlists support was added. This feature can be enabled with the following parameter

Code Block
themeRDark
hls_master_playlist_enabled=true

Master playlist file name can be set using the following parameter

Code Block
themeRDark
hls_manifest_file=index.m3u8

Browser should get master playlist by URL

Code Block
themeRDark
https://wcs_address:8445/streamName/index.m3u8

Where

  • wcs_address - WCS server address
  • streamName - stream name
  • index.m3u8 - master playlist file name

When master playlist is requested for the stream, server checks if streams are published according to transcoding profiles listed in cdn_profiles.yml file, for example:

Code Block
themeRDark
profiles:
  -720p:
    video:
      height: 720
      bitrate: 1000
      codec: h264
  -480p:
    video:
      height: 480
      bitrate: 1000
      codec: h264
  -240p:
    video:
      height: 240
      bitrate: 400
      codec: h264

All the streams published by profiles on server, will be added to master playlist, for example:

Code Block
themeRDark
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=1280x720,CODECS="avc1.42e01f,mp4a.40.2"
../streamName-720p/streamName-720p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1000000,RESOLUTION=852x480,CODECS="avc1.42e01f,mp4a.40.2"
../streamName-480p/streamName-480p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=426x240,CODECS="avc1.42e01f,mp4a.40.2"
../streamName-240p/streamName-240p.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720,CODECS="avc1.42e01f,mp4a.40.2"
../streamName/streamName.m3u8

Then browser switches between HLS streams listed in master playlist depending on channel bandwidth.

Warning

When browser requests master playlist for the certain stream, transcoded stream must already be published on server and must be cut to HLS segments

To provide HLS streams by profiles, the following should be done:

1. On a standalone server:

1.1. Periodically check if streams are transcoded to parameters set by profiles, and launch transcoding if necessary using REST API

Code Block
languagebash
themeRDark
	curl -s -X POST -d "{\"uri\":\"transcoder://tcode_test-240p\",\"remoteStreamName\":\"test\",\"localStreamName\":\"test-240p\",\"encoder\":{\"width\":320,\"height\":240}}" http://localhost:8081/rest-api/transcoder/startup
	curl -s -X POST -d "{\"uri\":\"transcoder://tcode_test-480p\",\"remoteStreamName\":\"test\",\"localStreamName\":\"test-480p\",\"encoder\":{\"width\":640,\"height\":480}}" http://localhost:8081/rest-api/transcoder/startup
	curl -s -X POST -d "{\"uri\":\"transcoder://tcode_test-720p\",\"remoteStreamName\":\"test\",\"localStreamName\":\"test-720p\",\"encoder\":{\"width\":1280,\"height\":720}}" http://localhost:8081/rest-api/transcoder/startup

1.2. Periodically launch HLS cut for the streams, for example

Code Block
languagebash
themeRDark
curl -s -X POST -d "{\"name\":\"test\"}" http://localhost:8081/rest-api/hls/startup
sleep 1
curl -s -X POST -d "{\"name\":\"test-240p\"}" http://localhost:8081/rest-api/hls/startup
sleep 1
curl -s -X POST -d "{\"name\":\"test-480p\"}" http://localhost:8081/rest-api/hls/startup
sleep 1
curl -s -X POST -d "{\"name\":\"test-720p\"}" http://localhost:8081/rest-api/hls/startup

2. On an Edge server in CDN periodically request HLS streams by transcoding profiles, for example

Code Block
languagebash
themeRDark
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

Debug logs for HLS session

For an error report, debug logging can be enabled for HLS sessions using CLI

...