record_unique
The 'record_unique' directive in the NGINX RTMP module appends a unique timestamp to recorded stream file names, preventing overwrites.
Description
The 'record_unique' directive is used in the context of live streaming applications in the NGINX RTMP module. When enabled, this directive modifies the naming scheme of recorded stream files by appending the current timestamp to the filename. This is particularly useful in scenarios where multiple streams with the same name might be being recorded concurrently. Without this directive, newly recorded streams could overwrite previous recordings, leading to data loss.
This directive takes a single argument, which typically is on to enable the unique naming feature. When set to 'on', every time a stream is recorded, it receives a unique name based on the current time, ensuring that previous stream files remain intact. The naming convention allows for easy identification based on the recording time, which is critical for archival and retrieval purposes.
The implementation of this directive relies on the core functionality of the RTMP module's stream recording capabilities. It interacts closely with other recording-related directives like 'record' and 'record_path', creating a cohesive setup for handling streams effectively in a live broadcast scenario. In use cases where real-time data integrity is crucial, employing 'record_unique' can greatly enhance the reliability of recorded media.
Config Example
application myapp {
live on;
record all;
record_path /var/www/html/records;
record_unique on;
}Ensure the record path is writable; otherwise, the recordings may fail without clear error messages.
Be aware that enabling 'record_unique' may lead to an accumulation of files in the recording directory, potentially requiring additional management to avoid disk space issues.