hls_muxdelay

The `hls_muxdelay` directive controls the maximum time to wait before generating a new HLS segment when streaming.

Syntaxhls_muxdelay number;
Default5s
Context
Arguments1

Description

The hls_muxdelay directive in the NGINX RTMP module is crucial for managing the timing of HLS segment files during live streaming. It defines the maximum amount of time the server will delay before creating a new HLS segment after having accumulated a certain amount of media data. This delay allows for better synchronization and efficiency, ensuring segments are neither too short nor too long while minimizing the frequency of file creation on the server, which can lead to performance gains in high-load environments.

When a broadcast stream is being processed, the hls_muxdelay parameter acts as a buffer setting that can optimize the user experience depending on the viewer's needs. A lower value results in shorter segments, providing faster updates of the stream to viewers, but may increase resource consumption and filesystem activity. On the other hand, higher values will yield fewer, longer segments, which could reduce the load on the filesystem but may increase latency for end users. Important considerations include balancing latency and resource usage based on the specific use case of the stream.

Config Example

hls_muxdelay 10s;

Setting hls_muxdelay too low may cause too frequent segment generation, which can impact server performance.

If set too high, it may lead to increased latency for viewers in getting updates of the stream.

← Back to all directives