record

The `record` directive in the NGINX RTMP module enables the recording of live streams for storage or later playback.

Syntaxrecord all | want | off;
Defaultoff
Context
Arguments1+

Description

The record directive is part of the NGINX RTMP module and is used within the application block to control stream recording behavior. It takes one or more arguments that define how and when streams should be recorded. The most common values for this directive include options like all, want, and off. When set to all, the directive records all published streams, while want records only if explicitly requested. The recordings can be saved in various formats and stored at a specified path, allowing for later retrieval or playback.

In conjunction with the record_path directive, which specifies the directory where recorded files are stored, record integrates seamlessly into the streaming workflow. It can also be configured with options like record_unique, which appends a unique identifier (such as a timestamp) to recorded files, ensuring that multiple recordings do not overwrite each other. This is particularly useful in live streaming scenarios where unique recordings must be maintained for different events or sessions. When used properly, it can enhance content management and archiving capabilities for streaming services.

Config Example

application live {
    live on;
    record all;
    record_path /tmp/recordings;
    record_unique on;
}

Ensure the record_path directory exists and has the correct permissions to allow NGINX to write files.

Incorrectly configuring the record directive can lead to unintentional overwriting of recording files if record_unique is not used when multiple streams are published.

Be mindful of disk space usage when recording multiple streams for extended periods, as this can fill up the storage quickly.

← Back to all directives