5

I'm using ffmpeg to convert mp4 files to hls files using the following command:

ffmpeg -i /var/mp4s/gua.mp4 -strict -2  -f hls /mnt/hls/index.m3u8

But after a few seconds, the .m3u8 and .ts files are automatically deleted. How to prevent them from deleting?

Ryan
  • 153
  • 1
  • 6

1 Answers1

5

Nginx cleans up the files by default, so we need to disable this function by adding hls_cleanup off;:

application myapp {
    live on;
    hls on;
    hls_path /tmp/hsls;
    hls_cleanup off;
}
Martin Thornton
  • 5,151
  • 11
  • 30
  • 39
Bali
  • 66
  • 1
  • 2
  • I think if he's serving existing hls ts content from server, then we would not need rtmp module altogether, http configuration to serve the m3u8 and ts files would be enough. The rtmp module would be necessary only if streaming to server or playing back over rtmp instead of http or https. – Mohyaddin Alaoddin Nov 17 '22 at 05:54