Fragment file names used in HLS streams

Updated by Bryan Jones

Scope

This document covers the naming of HLS fragment files in any of the Telos streaming products where HLS streaming is supported. At the moment, this covers the X/2 and 9X/2 software products as well as the R/2 and 9R/2 hardware appliance.

Description

HLS streaming is the process of creating small fragments of audio files (typically only a few seconds in length) that are then uploaded locally, by HTTP push, or by FTP, to a server to be played back by a streaming media player. The player then re-assembles these files in real-time.

Customers have asked if there is a way to control the naming of these fragment files. No, unfortunately, fragment names cannot be changed, and it's expected to be separated by folders.

For example, we would expect that each stream would have a different destination. Here's an example configuration;

Note the destination indicated by the arrow;

ftp://user:password@hostname:21/folder1/

We would expect additional streams to use a different folder. So, for example, this Rock stream uses folder1, my TechnoMusic stream would use folder2 like this.

ftp://user:password@hostname:21/folder2/

The names of the folders are not so important as the fact that they need to be unique.

The issue

The problem with having them in the same folder is that they have the same file naming structure. When you start a stream your filenames would be something like seg96000-00000001.ts

  • seg - tells us it's a segment file
  • 96000 - is the bit rate (if you create multiple bit rates you will have more than one file)
  • 00000001 - serialized number for the fragment. The next segment would be 2, then 3, etc.

If you write them all to the same folder, there is a chance that two segments could overlap, and you could have a segment from Rock playback on Techno.

Therefore, they need to be in separate folders.

One possible workaround

The encoder stores the last fragment number in Options.xml and changing that could give at least some separation between fragment numbering for multiple streams if those are all running simultaneously with the same fragment duration.

Usually, the Options.xml on the Z/IP Stream X/2 and 9X/2 installs in C:\ProgramData\Telos Systems\ZIPStream X2.

Open the file in a text editor, like Notepad++ or Visual Studio Code. Both of these are free editors where you can edit XML files. Change the XML property value here so that some larger numbers would separate each stream.

This option exists for each stream you have configured.
<option name="nextfragmentnumber" type="int" value="28"/>

Let us know how we can help

If you have further questions on this topic or have ideas about how we can improve this document, please contact us.


How did we do?