简体   繁体   English

nginx-rtmp-module 直播 stream 后如何保存视频并使用 hls 回放?

[英]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. nginx-rtmp-module直播后如何保存视频并用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.我用record存成flv再转flv转m3u8,如果视频大的话会很费时间。 If I use hls_cleanup off, I can't actively choose to turn the record on or off.如果我关闭了hls_cleanup,我就不能主动选择开启或关闭记录。 What is the correct way to save and play back using hls?使用 hls 保存和回放的正确方法是什么? Please or show me if you know.如果你知道,请告诉我。 Thanks very much非常感谢

For small video file, both DVR-FLV or HLS are OK.对于小视频文件,DVR-FLV 或 HLS 都可以。

For large video file, as you mentioned, HLS is better.对于大型视频文件,如您所述,HLS 更好。 You need to manage each ts file and its duration, to generate the m3u8 index when streaming finished.您需要管理每个 ts 文件及其持续时间,以便在流媒体结束时生成 m3u8 索引。

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.如果需要将多个publish stream合并为一个stream,HLS也比较好,比如需要调整编码器,换个编码器,或者网络失败重连服务器。 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).如果使用DVR-FLV,FLV文件会多一个,很难合并(需要转ts,拼接,再转码)。

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:此外,HLS 更适合在流式传输中制作,例如体育节目,您可能需要在直播过程中制作许多 VoD 文件,我们已经等不及流式传输结束了:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM