record_suffix

The `record_suffix` directive in the NGINX RTMP module specifies a suffix to append to recorded video files based on the current timestamp.

Syntaxrecord_suffix string;
Defaultnone
Context
Arguments1

Description

The record_suffix directive is utilized in the context of the NGINX RTMP module, specifically when streams are being recorded. When a stream is published, this directive allows the configuration of a suffix that will be added to the recorded file names. This feature is particularly useful for distinguishing between multiple recordings of the same stream, enabling users to avoid file name collisions by including unique timestamps or identifiers.

The directive takes a single string argument, which serves as the suffix for the recorded files. The NGINX RTMP module uses this suffix during the file recording process; hence, the recorded files will be named in the format <stream-name>_<timestamp><record_suffix>.flv. With this functionality, users can effectively manage recorded streams, especially in scenarios where multiple recordings are expected from different sessions or instances of streaming.

For example, if a stream is published at a certain time and the record_suffix is set to _v1, the resulting recorded file could be named like liveStream_1634920810_v1.flv. This helps in identifying and sorting recorded media files, especially in production settings where numerous streams may occur concurrently.

Config Example

application my_app {
    live on;
    record all;
    record_suffix _%Y%m%d_%H%M%S;
    record_path /var/www/html/records;
}

Ensure to use a valid format for the suffix; invalid characters may result in unexpected file names.

If record_unique is enabled, the suffix may not behave as intended due to overriding file naming.

Recordings will overwrite existing files with the same name unless unique identifiers are used. Please be cautious with overwrites.

← Back to all directives