hls_fragment_slicing

The hls_fragment_slicing directive in the NGINX RTMP module enables slicing of HLS fragments to optimize streaming performance.

Syntaxhls_fragment_slicing on | off;
Defaultoff
Context
Arguments1

Description

The hls_fragment_slicing directive allows administrators to set a specific behavior for how HLS fragments are sliced during the live streaming process. This directive is particularly useful when managing large streams, as it enables the system to create smaller fragment sizes that can be served to clients more efficiently. By slicing the fragments, it reduces the wait time for clients and enhances streaming smoothness, especially for users with varying bandwidth capabilities.

In practice, this directive works by specifying the slicing duration for the generated HLS fragments, providing a consistent experience for playback across different devices and network conditions. When the directive is enabled, the NGINX RTMP module will break the media stream into smaller chunks than the typical duration, allowing faster start times and seamless playback transitions. The precise configuration of this directive can be crucial for optimizing performance in a high-traffic streaming environment or when targeting multiple devices.

The usage of the hls_fragment_slicing directive can significantly improve user experience by ensuring that content is delivered efficiently regardless of the network state. It's important to configure this directive effectively depending on the expected audience and network conditions, as excessively small fragments might increase server load while larger fragments could lead to longer buffering times for viewers.

Config Example

application myapp {
    live on;
    hls on;
    hls_fragment_slicing on;
    hls_fragment 5s;
}

Enabling hls_fragment_slicing may increase the number of requests to the server, affecting performance under high load.

Ensure the duration of the fragments set in hls_fragment is compatible with the slicing behavior to avoid playback issues.

← Back to all directives