简体   繁体   English

从单个视频和循环创建假 hls live stream

[英]Create fake hls live stream from single video and loop

I am trying to simulate a live stream from a single video encoded as.ts files.我正在尝试从单个视频编码为 as.ts 文件模拟实时 stream 。 The playlist files looks like, example:播放列表文件如下所示,例如:

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-PLAYLIST-TYPE:EVENT
#EXT-X-VERSION:7
#EXT-X-START:TIME-OFFSET=9.56,PRECISE=YES
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:30.6250,
https://example.com/720p0.ts
#EXT-X-DISCONTINUITY
#EXTINF:29.5000,
https://example.com/720p1.ts
#EXT-X-DISCONTINUITY
#EXTINF:32.8750,
https://example.com/720p2.ts
#EXT-X-DISCONTINUITY
#EXTINF:30.8750,
https://example.com/720p3.ts

The #EXT-X-START:TIME-OFFSET=,PRECISE=YES indicates where the video should be played from which gets updated whenever a new rendition is requested. #EXT-X-START:TIME-OFFSET=,PRECISE=YES 指示视频应该在哪里播放,每当请求新的再现时,该视频就会更新。 In safari the stream loops when the #EXT-X-START:TIME-OFFSET value is updated to 0 and so on, but in chrome and firefox, the stream goes into a endless buffering. In safari the stream loops when the #EXT-X-START:TIME-OFFSET value is updated to 0 and so on, but in chrome and firefox, the stream goes into a endless buffering. I am using videojs for my player.我正在为我的播放器使用 videojs。

Is there any solution to have the m3u8 manifest loop in firefox and chrome?是否有任何解决方案可以在 firefox 和 chrome 中使用 m3u8 清单循环?

The hls spec is confusing at best, it can be pain. hls 规范充其量是令人困惑的,它可能会很痛苦。

try X9K3试试X9K3

I just added fake live streaming to x9k3 a few weeks ago.几周前我刚刚在 x9k3 中添加了假直播。 x9k3 segments mpegts to hls. x9k3 将 mpegts 分段为 hls。

To simulate live playback, x9k3 throttles itself.为了模拟实时播放,x9k3 会自行调节。 If a segment is two seconds in duration, x9k3 takes two seconds to create the segment and update the m3u8.如果一个段的持续时间为 2 秒,x9k3 需要两秒钟来创建该段并更新 m3u8。

It does not loop a file, however, that would be trivial to add.但是,它不会循环添加文件,这将是微不足道的。

https://github.com/futzu/x9k3#stream-diff https://github.com/futzu/x9k3#stream-diff

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

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