hls_fragment_naming

Sets the naming scheme for HLS fragment files generated by the NGINX RTMP module.

Syntaxhls_fragment_naming format;
Defaultnone
Context
Arguments1

Description

The hls_fragment_naming directive is used to define how the names of HLS fragments are constructed in the NGINX RTMP module. By default, the fragment files are generated based on timestamps and sequence numbers. Depending on the argument provided, it can enforce a custom naming convention that could include timestamps or sequence numbers based on user needs. This is particularly useful for scenarios where clients or external systems depend on a specific file naming structure to correctly identify and access these fragments.

The argument specification in the directive allows for a single parameter that denotes the naming format. Common formats might involve using placeholders for the stream name, timestamp, and sequence number. The behavior of this directive allows for either unique identifiers for each fragment for easier access and management or a conventional scheme that might be easier for traditional systems to handle. In addition, careful consideration should be given to the chosen naming convention to avoid collisions and ensure that files are easily accessible and managed on the server side.

When configuring the hls_fragment_naming, it is essential to validate that the specified naming pattern aligns well with the playback scenarios being looked at. Additionally, understanding how this fits into the overall file management, cleanup, and delivery process will help in setting it efficiently.

Config Example

hls_fragment_naming 'fragment-$seq-$timestamp.ts';

Ensure the naming format is unique to avoid file overwriting.

Using incorrect placeholders can lead to errors in fragment generation.

Not validating file paths may lead to runtime errors.

← Back to all directives