Creating HLS packages

How to create Apple HLS adaptive bitrate packages

HLS is a media streaming protocol developed by Apple for iOS, Apple TV and OS X that over time has gained support on a number of other platforms due to its popularity.

Originally HLS used H.264 as the video codec, encapsulated by MPEG-2 TS chunks. References to the segmented files are contained in .m3u8 manifest files. At the moment it also allows for byte-range addressing for fragmented MP4 files.

HTTP byte range requests let you specify segments as byte ranges of a larger file, which allows all segments to remain consolidated into one single large file. This approach offers 3 main benefits:

  • improved caching performance as the media player is walking through a larger file in a sequence rather than downloading each segment from a different location
  • there are fewer files to manage which can translate into savings on storage space
  • ability to use both HLS and MPEG-DASH manifests for the same media files which means cost savings and allows for broader compatibility across different players

Create a dedicated Factory for HLS output

Log in to your Telestream Cloud account and create a new Flip Service Factory as usual. Give it a meaningful name and define the output path format for your files. You can use a set of predefined keywords that make it easier to put output files in specific folders based on certain parameters.

The following keywords can be combined to create your outputs path format:

  • :id - ID of the encoding.
  • :video_id - ID of the video.
  • :original - original filename of the uploaded video
  • :date - date the video was uploaded (YYYY-MM-DD).
  • :profile - profile name used by the encoding.
  • :type - video type, original or encoding
  • :resolution - resolution of the encoding

In the case of Adaptive Bitrate (ABR) formats such as HLS it's particularly useful as you may end up with a large number of segments for each variant being delivered to a single folder in your storage. For example my-path/:resolution/ output path format used for either HLS or MPEG DASH is an easy way to group output files by variant.

Select the output storage to use, and optionally add a watch-folder which will trigger jobs automatically anytime a new source file arrives.

Here are some user guides to help with storage setup and how to get started with watch-folders


Create Factory

Click Next to go to the profiles selection screen. Go to the Multiscreen tab and select HLS Apple Recommended. This will create a complete set of HLS variants based on guidelines from Apple. You can always modify these later. References to the segmented files are contained in .m3u8 manifest files.


Multiscreen profiles

Click Next to go to the profiles summary and then Finish to complete.


Editing HLS variants

Apple's recommended variants can be used as a starting point to build your own set that matches your requirements more closely. To see your HLS variants go to your newly created Factory and click Encoding profiles to view the list. To edit each profile simply click on it or on the settings icon.


Single file per variant

HTTP byte range requests allows the encoder to specify segments as byte ranges of a a single file instead of as a separate file per segment. A client playing your media is walking through a larger file in a sequence rather than downloading each segment from different location. This improves caching performance and means there are fewer files to manage.

By default Enable HTTP Byte Range requests is off. If enabled, the output will be one H.264 video file wrapped in a Transport Stream container for each variant. Otherwise, each output will consist of a number of 10 second segments for each variant.


HLS content can be encrypted with AES-128 using an existing or randomly generated key. For an extra layer of encryption keys can be served over SSL. This can be done when only when creating HLS packages through the API.

HLS job results

If finished successfully, the job details view will list all the HLS variants created and delivered to your output storage. You can preview them directly in the browser and also download manifest files if needed.


Encoding job details - HLS