0

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

Björg
  • 1
  • 4
  • Set a profile. If you don't it may produce a 4:4:4 profile file which many decoders do not support. – Florian Zwoch Oct 14 '20 at 13:43
  • thanks for your answer @FlorianZwoch i came across this for another issue but i couldn't figure out how to do it do you have a link or something documenting this ? thanks. – Björg Oct 14 '20 at 13:49
  • https://gstreamer.freedesktop.org/documentation/x264/index.html?gi-language=c 3rd example forces baseline profile. – Florian Zwoch Oct 14 '20 at 14:09
  • so i've tried settig profile to baseline but nothing changed the video is still playable in the ubuntu videoplayer and chrome but not on firefox and safari.@FlorianZwoch thanks for the link. i was thinking that maybe the problem is the fact that i'm doing it in a pipeline frame by frame did anyone else experience something similar ? – Björg Oct 14 '20 at 14:26

1 Answers1

0

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

Björg
  • 1
  • 4