record_max_size

Sets the maximum size for recorded RTMP streams in the NGINX RTMP module.

Syntaxrecord_max_size size;
Defaultnone
Context
Arguments1

Description

The record_max_size directive in the NGINX RTMP module specifies the maximum size of the recorded file for an RTMP stream. When recording streams, it is essential to manage disk space effectively, especially when dealing with high-bitrate streams or multiple simultaneous recordings. By setting a limit using record_max_size, administrators can ensure that any recorded file does not exceed a predetermined size, which can help with storage management and mitigate the risk of excessive files consuming disk space.

This directive takes a single argument that defines the maximum size in bytes. If the size is exceeded during recording, the NGINX RTMP module will stop further recording for that specific stream. This means that any data generated beyond this limit will not be saved, which allows for control over what is written to disk. It is crucial to choose an appropriate size that balances between preserving necessary content and managing available storage resources.

record_max_size can be combined with other recording directives such as record_path and record to create comprehensive recording configurations. Configuration should take into account the expected stream quality, duration, and available disk space to set a reasonable limit that does not truncate important data unintentionally.

Config Example

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            record all;
            record_path /tmp/recordings;
            record_max_size 10M;
        }
    }
}

Setting record_max_size too small may result in loss of important stream data due to premature stopping of recording.

If record is not enabled, record_max_size will have no effect, so ensure both are configured properly.

← Back to all directives