Skip to content

HLS Playback

Flussonic Media Server supports playing video via the HLS protocol. Many of Flussonic's HLS features use non-standard extensions of HLS – we support them for your convenience.

The supported codecs are: H264, H265, MPEG2 video, AAC, MP3, MPEG2 audio, and AC-3.

Flussonic Media Server supports access via HLS to live streams, VOD files and DVR (catchup and timeshift).

If an incoming stream has DVB subtitles or teletext, then Flussonic can pass them to an output HLS stream if you configure Flussonic for that. Subtitles are saved in DVR archive if a stream is recorded to the archive.

On this page:

Structure of HLS protocol

HLS protocol works by breaking the overall stream or file into a sequence of media segments of equal length. The segments are represented by .ts files sequentially downloaded by HTTP. HLS also creates an index file that contains references of media segment files, saved as .m3u8.

Depending on usage scenario, you can use different URLs for HLS playback, but in any case, the URL will result in one of the following two types of playlists (or manifests).

Media Playlist

Media Playlist is a playlist where all lines identify media segments. Each media segment is specified by a URI and has the .ts extension. The playlist continues to be updated as new media URIs are added. Such a playlist is used for playing simple streams or files with only one video track and one audio track.

Media Playlist example:

#EXTM3U
#EXT-X-TARGETDURATION:7
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:38530
#EXT-X-PROGRAM-DATE-TIME:2022-03-22T08:06:37Z
#EXTINF:5.000,
2022/03/22/08/06/37-05000.ts
#EXTINF:5.000,
2022/03/22/08/06/42-05000.ts
#EXTINF:5.000,
2022/03/22/08/06/47-05000.ts
#EXTINF:5.000,
2022/03/22/08/06/52-05000.ts

Master Playlist

Master Playlist is a playlist where all lines identify Media Playlists. Each Media Playlist is specified by a URI and has the .m3u8 extension. Master playlist may be used for multibitrate playback and allows clients to switch between bitrates dynamically.

Master Playlist example:

#EXTM3U
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,RESOLUTION=640x480,FRAME-RATE=25.000,CODECS="avc1.4d001f,mp4a.40.2",AVERAGE-BANDWIDTH=500000,BANDWIDTH=630000
tracks-v3a1/mono.m3u8
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,RESOLUTION=768x576,FRAME-RATE=25.000,CODECS="avc1.4d001f,mp4a.40.2",AVERAGE-BANDWIDTH=610000,BANDWIDTH=770000
tracks-v2a1/mono.m3u8
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,RESOLUTION=960x720,FRAME-RATE=25.000,CODECS="avc1.4d001f,mp4a.40.2",AVERAGE-BANDWIDTH=650000,BANDWIDTH=820000
tracks-v1a1/mono.m3u8

General standard HLS playback

When you have a simple live stream or file (one video track, one audio track) for playing, the URL for playback via HLS is simple:


http://FLUSSONIC-IP/STREAM_NAME/index.m3u8

where FLUSSONIC-IP stands for your Flussonic Media Server host + port address.

Flussonic Media Server will also accept playlist.m3u8 in the end of the URL for backward compatibility with other servers.

When you start working with multi-language or multi-bitrate content, things become more complicated.

HLS playback of fMP4 for H.265

Fragmented MP4 (fMP4) offers important benefits. First of all, it is the only way to play HEVC video via the HLS. Besides, the MP4 container is supported by any player, in contrast with MPEG. The fMP4 format can also used by DASH, so that only the manifest would be different from HLS while the MP4 encoding would be performed once for both protocols.

The following URL allows HLS playback as fMP4 chunks:


http://FLUSSONIC-IP/STREAM_NAME/index.fmp4.m3u8

where FLUSSONIC-IP stands for your Flussonic Media Server host + port address.

Playback via Low-Latency HLS

Flussonic allows playback via Apple Low-Latency HLS (LL-HLS) — a streaming protocol that derives from HLS and overcomes its high latency.

LL-HLS supports the same codecs as HLS (H.264, AAC, MP3) and also HEVC (H.265). The container can be MPEG-TS or fMP4 (fragmented MP4). Flussonic uses fMP4 and CMAF to package streams for LL-HLS delivery. Flussonic creates fMP4 chunks in accordance with the CMAF standard.

Pre-requisites

Before using Low-Latency HLS, remember that network and server load will increase because Low-Latency HLS divides HLS segments into smaller segments (also called chunks).

Also, to get really low latency, you should prepare the stream by encoding it with very small GOP (group of pictures). We recommend a GOP of the size equal to 1 or 2 seconds. Flussonic’s transcoder produces the GOP of a constant size, which you can specify in transcoder settings. If your video has FPS=25, then a one-second GOP will have a size of 25 frames, and you'll need to specify it in the transcoder settings.

GOP for LL-HLS

How to configure LL-HLS

To play a stream via Apple Low-Latency HLS:

  1. Enable CMAF for the stream in the etc/flussonic/flussonic.conf file:

stream example_stream {
  input fake://fake;
  cmaf on;
}

CMAF is a standard that is used to create MP4 fragments compliant with the Low-Latency HLS specification.

Set the following parameters (if necessary):

Parameters Unit Description Example
segment_duration integer (in seconds) The duration of an HLS segment. segment_duration 4;
segment_count integer Number of segments in an HLS playlist. segment_count 4;
chunk_duration integer (in milliseconds) The duration of a CMAF Chunk or HLS Partial Segment of an HLS segment. The default value is 200. chunk_duration 300;

Then reload Flussonic by reloading Flussonic:


service flussonic reload

Note

It is not necessary to reload Flussonic every time you set or modify any of the parameters above. Simply set or change the value of the parameter(s) and save the configuration.

  1. Access the stream by opening the following URL in the player:

http://FLUSSONIC-IP/example_stream/index.ll.m3u8

The player THEOplayer fully supports LL-HLS playback.

Multilanguage HLS

If you want to play your multilanguage stream on iPhone you need to use the same http://flussonic-ip/STREAM_NAME/index.m3u8

But when you want to watch a multi-language stream using VLC or a set-top box, the video mode must be turned on.

URL for the player will be:


http://FLUSSONIC-IP/STREAM_NAME/video.m3u8

This is due to the Apple HLS requirement of a separate playlist with an audio-only option for each individual language. MPEG-TS uses another algorithm: all audio tracks are packed in the same container with the video, and it is up to the player which one to play. So, to make sure the video is viewable on iPhone, it must satisfy the requirements of Apple. At the same time, VLC and STBs, in violation of the HLS standard, expect the old version of MPEG-TS converted to HLS. This is why this trick with different URLs is needed.

Adding 'Audio only' for Apple devices

Apple requires that all your streams must include a version without video, only with audio.

They suppose that if a user is watching video via 3G and has moved to a zone with bad network conditions, it would be better to have audio only than video with buffering.

Flussonic allows you to enable audio-only mode in the following way:


stream example {
  input file://vod/bunny.mp4;
  add_audio_only;
}

Note

Such a configuration might make your index.m3u8 URL unplayable on VLC or STB — in that case use video.m3u8 option (described earlier on this page).

Separate playlists for STBs

If you have a multi-bitrate multilanguage content and want to play it on STB that doesn't support multi-bitrate HLS playlists, you can request from Flussonic Media Server separate playlists with one video track and all audio tracks like with the mono option:


http://FLUSSONIC-IP/STREAM_NAME/mono.m3u8

This playlist is not a variant (multi-bitrate) playlist, but it is a playlist with URLs to segments that contain the first video track and all available audio tracks.

If you want to deliver multilanguage multi-btrate to STB that doesn't understand Apple standard for multilanguage, use video.m3u8:


http://FLUSSONIC-IP/STREAM_NAME/video.m3u8

This is a variant playlist that will give you a list of non-variant playlists like video1.m3u8, video2.m3u8, etc.

Separate audio playlists

Some Smart TVs (like Samsung TV) and browsers, supporting the MSE (Media Source Extensions) standard, cannot switch between the audio tracks if HLS stream has multiple audio tracks encoded (for instance, for different languages). As a result, players do not display these audio tracks, or a stream might not be played at all.

Flussonic can create a playlist with separate audio for such cases. To enable this feature, add separate_audio=true in the query string to request the HLS playlist for the player:


http://FLUSSONIC-IP/STREAM_NAME/index.m3u8?separate_audio=true

So the playlist will looks as follows:


#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="eng a1",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="eng",URI="tracks-a1/mono.m3u8"
#EXT-X-STREAM-INF:AUDIO="aac",CLOSED-CAPTIONS=NONE,RESOLUTION=320x240,FRAME-RATE=25.000,CODECS="avc1.420015,mp4a.40.2",AVERAGE-BANDWIDTH=240000,BANDWIDTH=310000
tracks-v1/mono.m3u8

It works for Live, VOD, and DVR playlists.

This is how to request such a playlist for DVR:


http://FLUSSONIC-IP/STREAM_NAME/archive-1643098810-30.m3u8?separate_audio=true

The output would look like so:


#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",NAME="eng a1",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="eng",URI="tracks-a1/index-1643098810-30.m3u8"
#EXT-X-STREAM-INF:AUDIO="aac",CLOSED-CAPTIONS=NONE,RESOLUTION=320x240,FRAME-RATE=25.000,CODECS="avc1.420015,mp4a.40.2",AVERAGE-BANDWIDTH=240000,BANDWIDTH=300000
tracks-v1/index-1643098810-30.m3u8

DVR catchup playback

When your stream is already recorded on server with our DVR you can play video via HLS when you know beginning of telecast and end for example from EPG.

Available URLs will be:


http://FLUSSONIC-IP/STREAM_NAME/archive-1362504585-3600.m3u8

This is a regular playlist that will be variant playlist if you have more than one language or more than one bitrate.

It will deliver a list of segments starting from UTC 1362504585 ( 2013, March, 5th, 17:29:45 GMT) and for one hour forward.

The mono URL will give you list of segments that contain all tracks in MPEG-TS:


http://FLUSSONIC-IP/STREAM_NAME/mono-1362504585-3600.m3u8

More specific videoN playlist will give you a list of segments with an N'th video track and all audio tracks:


http://FLUSSONIC-IP/STREAM_NAME/video1-1362504585-3600.m3u8

and a variant video playlist with a list of videoN playlists:


http://FLUSSONIC-IP/STREAM_NAME/video-1362504585-3600.m3u8

HLS Event playlist

You can access Event playlist with the URL:


http://FLUSSONIC-IP/STREAM_NAME/index-1362504585-now.m3u8

Event playlists are used when you want to allow the user to seek to any point within the event, e.g webinar, concert, current tv show.

Please notice that player will start playback from the live, not from the requested timecode, to access DVR data you should seek into the past.

Rewinding a playlist

Flussonic Media Server has a special playlist "rewind-N.m3u8" with a wide sliding window that allows to rewind and pause HLS streams for many hours.


http://FLUSSONIC-IP/STREAM_NAME/rewind-7200.m3u8

7200 is a duration of a HLS manifest in seconds, so your clients will be able to pause the stream up to two hours or rewind to the start of TV show without accessing catchup URLs.

DVR timeshift playback

If your stream is being recorded on disk but you haven't configured a timeshifted stream for it, then you can play timeshifted video via HLS by using a propely constructed URL.

Here goes the list of URLs for relative timeshift:


/timeshift_rel-3600.m3u8
/mono-timeshift_rel-3600.m3u8
/video-timeshift_rel-3600.m3u8
/video1-timeshift_rel-3600.m3u8

and these are URLs for absolute timeshift:


/timeshift_abs-1508403742.m3u8
/mono-timeshift_abs-1508403742.m3u8
/video-timeshift_abs-1508403742.m3u8
/video1-timeshift_abs-1508403742.m3u8

Playing individual tracks

If a stream has several audio and video tracks, you can specify which tracks should be delivered. To do so, specify the track numbers by adding the parameter filter.tracks to the stream's URL.

Examples:

Select the first audio and second video tracks:


http://FLUSSONIC-IP/STREAM_NAME/index.m3u8?filter.tracks=v2a1

Select video only:


http://FLUSSONIC-IP/STREAM_NAME/index.m3u8?filter.tracks=v1

DVR archive playback starting from UTC 1362504585 and with the duration of 3600 seconds:


http://FLUSSONIC-IP/STREAM_NAME/archive-1362504585-3600.m3u8?filter.tracks=v2a1

Sorting tracks in multibitrate playlist

If a multibitrate stream is used, all tracks are listed in the master playlist. By default, video tracks are sorted by bitrate in ascending order, i.e., playback starts from the video track with the lowest bitrate.

If you want to change the order of the tracks and start playing from another track, you can use the parameter filter.tracks for this purpose. Specify video and audio track numbers in this parameter in the desired order, and the tracks in the playlist will be sorted correspondingly. For example:

http://FLUSSONIC-IP/STREAM_NAME/index.m3u8?filter.tracks=v3v2v1a2a1

In this case default tracks will be v3 and a2.

HLS playback with thumbnails

It is possible to add thumbnails into HLS playlist as special tags that a player can read. It works both for streams with DVR enabled and for VOD files.

To include thumbnails into the playlist, add ?thumbnails= option to the stream or the VOD file URL.

Example for a DVR window:

http://flussonic:80/ort/index-1644304617-60.m3u8?thumbnails=50

Example for a VOD file:

http://flussonic:80/vod/bunny.mp4/index.m3u8?thumbnails=100

This value defines how many thumbnail links will be added to the thumbnail playlist to cover the duration of the DVR window or the VOD file correspondingly. The player will add the thumbnail links to the progress bar at regular intervals. The duration of the interval between thumbnails is the whole duration of the DVR window or the VOD file divided by this value.

If you specify a big number, then the player will use additional resources which may make the player or the browser stuck. Decreasing this parameter allows to limit the number of thumbnails to play and thus to reduce the player resources usage.

This option requires the parameters thumbnails enabled=ondemand and size (thumbnail size) included in the stream or VOD location settings. For example, thumbnails enabled=ondemand size=320x240;. You can specify multiple sizes separated by spaces, for example, size=320x250 size=640x480. In this case, several thumbnails tracks will be included into the playlist. Each thumbnail in the playlist will be resized proportionally to fit the specified size.

For more information, please refer to Playback API schema.