record_path

The 'record_path' directive specifies the directory path where recorded streams are saved when using the NGINX RTMP module.

Syntaxrecord_path path;
Defaultnone
Context
Arguments1

Description

The 'record_path' directive in the NGINX RTMP module is utilized to define a specific directory where video streams are stored during recording. It is crucial for applications that leverage live streaming capabilities as it allows for the management of recorded content. When a stream is published, all data for that stream is captured and written to the specified path. This path must be accessible by the NGINX user and should have appropriate permissions to allow for writing files.

When configuring 'record_path', ensure that a valid directory location is provided. The path can be absolute or relative to the NGINX working directory. If the specified directory does not exist or if there are permission issues, recordings will not be created, leading to potential service interruptions or data loss. It's essential to manage disk space as well, considering that recorded stream sizes can grow rapidly depending on streaming duration and bitrate.

In addition to specifying the storage path, users can combine 'record_path' with other directives for more control over the recording process, such as 'record_max_size', which limits the size of recorded files or 'record_unique', which can ensure that recorded streams have unique filenames based on timestamps. This helps in organizing recorded content effectively and avoiding file overwriting.

Config Example

rtmp {
    server {
        listen 1935;
        application live {
            live on;
            record all;
            record_path /var/rtmp/recordings;
            record_max_size 1G;
            record_unique on;
        }
    }
}

Ensure the specified path is writable by the NGINX user to prevent permission denied errors.

If using a relative path, verify it is resolved correctly in relation to the NGINX working directory.

If disk space is not monitored, recorded files may fill the disk, causing NGINX to crash or become unresponsive.

← Back to all directives