HLS Configuration File

The HLS Plugin included in the Red5 Pro Server distribution reads the configuration file at red5pro/conf/hlsconfig.xml.

The following properties are defined to configure the HLS playlist:

  • itemCount - The number of segments in the sliding window
  • itemLength - The segment duration
  • itemThreshold - The HLS segmentation variance. It should be higher than 0.5 and less than 1
  • useDiskWrites - If you have a large duration and segment count, you may prefer to serve the HLS files from disk

Property defaults from conf/hlsconfig.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean name="hlsConfig" class="com.red5pro.stream.transform.mpegts.HLSConfig" >
                <!-- Number of items in the HLS playlist -->
                <property name="itemCount" value="5"/>
                <!-- The segment duration in seconds for each item.  -->
                <property name="itemLength" value="6"/>
                <!-- The segment duration variance. The range should be higher than 0.5 and lower than 1.0.
                That is to configure segments generated more than half of the desired duration.
                The effectiveness of segmentation is dependant on the keyframe interval -->
                <property name="itemThreshold" value="0.7"/>
        <!-- Maximum hls segment length in bytes. Forces segmentation when segment grows to this size. -->
        <property name="maxSegmentSize" value="8000000"/>
                <!--  -->
                <property name="useDiskWrites" value="true"/>
                <!-- Post processing mode:
                      0 = Legacy, no append, no ffmpeg requirement (default)
                      1 = Uses the Orientation Post Processor requiring ffmpeg and also enables "append" handling
                <property name="postProcessMode" value="0"/>
                <!-- truncating audio while waiting for video:
                      true = the first output segment should contain video stream
                      false = output everything as is
                <property name="waitForVideo" value="false"/>
        <!-- Provide post-processing for recorded HLS files -->
        <property name="writerPostProcessors">
                <!-- Creates a VOD playlist with associated segments and moves it to vod app or cloud storage upload
                     To use non-append mode, set `legacy` to `true`
                <!-- Cleans up the .ts and .m3u8 files if they were written -->
        <!-- Debug mode -->
        <property name="debug" value="false"/>
        <!-- Force VOD recording -->
        <property name="forceVODRecord" value="false"/>
        <!-- Cloud uploaders are queried in the post processor, no special configuration entry required here -->
        <!-- Automatically upload if the Cloudstorage plugin is configured -->
        <property name="doCloudstorageUpload" value="true"/>
        <!-- To write json metadata or not to write it to a file -->
        <property name="writeJsonMetadata" value="true"/>
        <!-- Time in seconds to sleep before invoking post processors, to allow HLS clients to watch a stream to the end -->
        <property name="sleepOnPlaylistClose" value="30"/>