使用GST(TS M3U8)生成的hls无法在野生动物园中播放(但适用于Chrome) [英] hls generated with gst (ts m3u8) not playing on safari (but working on chrome)

查看:126
本文介绍了使用GST(TS M3U8)生成的hls无法在野生动物园中播放(但适用于Chrome)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用gst从现有管道中的帧生成hls视频.一旦我将帧作为一个numpy数组,就使用以下代码创建ts和m3u8文件:

i'm trying to use gst to generate an hls video from frames within an existing pipeline. once i get the frame as a numpy array i use the following to create the ts and m3u8 file :

            appsrc emit-signals=True do-timestamp=true is-live=True  
            caps={DEFAULT_CAPS}".format(**locals()) !
            "queue" !
            "videoconvert" !
            "x264enc" !
            "mpegtsmux" !
            f"hlssink location={playlist}.%04d.ts " !
            f"playlist-location={playlist}.m3u8"]) 

where default caps = "video/x-raw,format={VIDEO_FORMAT},width={WIDTH},height={HEIGHT},framerate={FPS_STR}".format(**locals())

这是m3u8文件的示例:

here's an example of the m3u8 file :

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:15

#EXTINF:15.000000953674316,
20201014_103647.0000.ts
#EXTINF:15.000000953674316,
20201014_103647.0001.ts
#EXTINF:15.000000953674316,
20201014_103647.0002.ts
#EXTINF:7.8000001907348633,
20201014_103647.0003.ts
#EXT-X-ENDLIST

在我的ubuntu视频播放器上和chrome上都可以正常播放,但在safari和firefox上却不能正常播放.我试过稍微改变一下管道,但没有任何效果,也不知道到底是什么问题. 有人有什么主意吗?

it's playing fine with my ubuntu video player and on chrome but not on safari and firefox. i've tried changing the pipeline a little but nothing worked and don't really know what's the problem. does anyone have any idea ?

按照评论中的建议,我尝试更改配置文件,但没有进行任何更改. 我还发现它添加了无声音频可以解决该问题,因为浏览器可能期望这样做.

following the advice in the comments i tried changing the profile but it didn't change anything. I also found that it adding a silent audio could resolve the problem cause the browser might be expecting that.

编辑

所以组合音频+配置文件使其起作用,但是由于我正在使用appsrc获取帧,所以我不知道视频将持续多久,因此如何在没有该信息的情况下生成音频? 谢谢

so the combo audio + profile makes it work but since i'm using appsrc to get the frames i don't know how long the video is gonna be so how can i generate an audio without that information ? thanks

推荐答案

为使其正常运行,我将配置文件设置为高,并在视频上添加了音频.

So to make it work i set the profile to high and added an audio over the video.

这篇关于使用GST(TS M3U8)生成的hls无法在野生动物园中播放(但适用于Chrome)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆