m3u8和ts文件在一段时间后被删除

Rya*_*yan 6 nginx rtmp

我使用 ffmpeg 使用以下命令将 mp4 文件转换为 hls 文件:

ffmpeg -i /var/mp4s/gua.mp4 -strict -2  -f hls /mnt/hls/index.m3u8
Run Code Online (Sandbox Code Playgroud)

但几秒钟后,.m3u8 和 .ts 文件会自动删除。如何防止他们删除?

小智 6

Nginx默认会清理文件,因此我们需要通过添加以下内容来禁用此功能hls_cleanup off;

application myapp {
    live on;
    hls on;
    hls_path /tmp/hsls;
    hls_cleanup off;
}
Run Code Online (Sandbox Code Playgroud)