record_max_frames
The `record_max_frames` directive limits the maximum number of frames recorded during a live stream in the NGINX RTMP module.
Description
The record_max_frames directive is used within the NGINX RTMP module to manage the number of frames that can be recorded from a live stream. By setting this directive, users can specify a threshold for how many frames to save, which can be useful for controlling resource consumption on the server. When the maximum number of frames is reached, older frames may be discarded to make room for new ones, ensuring that the recording does not grow indefinitely and thereby conserving memory and storage.
The parameter for record_max_frames is a positive integer that dictates this upper limit. For example, if set to 1000, the server will retain a maximum of 1000 frames in the buffer before beginning to overwrite the oldest frames in the sequence. This is particularly relevant in situations where live streaming is expected and where preserving the most recent content takes precedence over the archival of all transmitted data.
In practice, configuring this directive correctly is important for maintaining effective streaming performance and avoiding potential resource exhaustion. If the number of frames specified is too high for the server's specifications, it may lead to increased latency or performance degradation as the server struggles to manage memory and processing tasks efficiently throughout the streaming session.
Config Example
application live {
live on;
record all;
record_path /tmp/av;
record_max_frames 1000;
}Setting record_max_frames too high can lead to increased memory consumption and potential performance issues.
If record_max_frames is not set, the server will not limit the frames, possibly leading to unbounded resource usage.