Search code examples
nginxstreamingrecordrtmp

How can save video after live stream of nginx-rtmp-module and play it back using hls?


How can I save the video after live streaming of nginx-rtmp-module and play it back with hls . I use record to save to flv and then convert flv to m3u8, it takes a lot of time if the video is large. If I use hls_cleanup off, I can't actively choose to turn the record on or off. What is the correct way to save and play back using hls ? Please or show me if you know . Thanks very much


Solution

  • For small video file, both DVR-FLV or HLS are OK.

    For large video file, as you mentioned, HLS is better. You need to manage each ts file and its duration, to generate the m3u8 index when streaming finished.

    If you need to merge multiple publish stream to one stream, HLS is also better, for example, if need to adjust the encoder, use another encoder, or reconnect to server for network fail. If use DVR-FLV, there will be more than one FLV file and it's hard to merge them(need to covert to ts, concat them, then transcoding).

    Furthermore, HLS is much better for producing during streaming, like sport programs, you may need to produce many VoD files during live streaming, and we can't wait streaming end:

    encoder ---RTMP---> Server --HLS--> VoD During Streaming