record_interval

The 'record_interval' directive specifies the interval at which stream recording segments are created in the NGINX RTMP module.

Syntaxrecord_interval milliseconds;
Defaultnone
Context
Arguments1

Description

The 'record_interval' directive in the NGINX RTMP module allows for the configuration of time intervals in milliseconds for creating recording segments while live streaming. Setting this directive enables more granular control over the recording duration, allowing users to specify a custom interval for each recorded segment. This can help in managing recorded content by generating multiple video files for a single stream based on time intervals, facilitating easier playback or processing of shorter clips. Note that shorter intervals result in more files being created, which may increase file management complexity and overhead.

The 'record_interval' directive expects an argument that defines the duration of these segments. This value is interpreted in milliseconds and should be adjusted based on the streaming requirements and the intended use-case for the recorded content. For example, a record interval of 5000 (or 5 seconds) would create a new segment every 5 seconds during an active stream. This could be useful in scenarios where frequent breaks in the stream may occur or where particular segments need to be easily identifiable for editing or archiving purposes. However, care should be taken to balance the interval duration to avoid excessive file creation while ensuring that segments remain manageable in size.

Config Example

rtmp {
    server {
        listen 1935;
        application live {
            live on;
            record all;
            record_path /tmp/recordings;
            record_interval 5000;
        }
    }
}

Ensure that the specified interval is not too short to avoid overwhelming the filesystem with too many small files.

Consider the overall performance impact on disk I/O when recording at very short intervals.

Test the setup thoroughly to determine the optimal segment length that meets specific recording and playback needs.

← Back to all directives