dash_cleanup
The dash_cleanup directive enables the cleanup of old MPEG-DASH segments after playback completes.
Description
The dash_cleanup directive is designed to manage the lifecycle of MPEG-DASH segments by removing older segments from the file system once they are no longer needed. This helps in controlling disk space and ensuring that only the necessary segments remain available for streaming. It works by specifying a Boolean flag that, when enabled, triggers the deletion process during playback. If active, the server will monitor the segments generated for a DASH stream, identifying which segments can be safely removed based on the current playback position and the specified playback length.
The behavior of dash_cleanup is closely tied to the segmentation and expiration logic defined within the RTMP module for DASH streams. When a stream is terminated or a playback session ends, the server checks for old segments that are no longer referenced by the active streams. If the playback length is defined correctly, segment files that fall outside this defined length can be efficiently purged from the storage, thus optimizing resource utilization.
Parameters for this directive involve enabling or disabling the cleanup functionality. When applying this directive, it is crucial to ensure that the server has the proper access rights to delete these files, which may require appropriate permissions on the file system level. This functionality is especially beneficial for high-traffic streaming environments where multiple users interact with content, as it reduces clutter from leftover streaming data.
Config Example
application myapp {
dash on;
dash_cleanup on;
dash_fragment 5s;
dash_path /path/to/dash_files;
}Ensure the NGINX user has permission to delete dash segments in the specified directory.
The cleanup process may lag behind real-time playback, leading to temporary storage bloat if stream sessions are very short.
Misconfiguration of playback length may lead to premature deletion of segments that are still in use.