Search code examples
firefoxgstreamerhlslgstreamer-1.0python-gstreamer

hls generated with gst (ts m3u8) not playing on safari (but working on chrome)


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())

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

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.

EDIT

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


Solution

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