2

I used the below command using gstreamer. I see the generated files in the root but VLC crashes when I try to open the playlist.m3u8 The main goal is to live stream from webcam on firefox browser.

gst-launch-1.0 ksvideosrc ! decodebin ! videoconvert ! openh264enc ! mpegtsmux ! hlssink playlist-root=localhost location=C:/inetpub/wwwroot/hlssink.%05d.ts playlist-location=C:/inetpub/wwwroot/playlist.m3u8

also the video tag doesn't show the video streaming.

<video width="352" height="198" controls>
    <source src="http://localhost/playlist.m3u8" type="application/x-mpegURL">
</video>

I can't figure out what I am doing wrong here ; any help would be appreciated.

Nafiseh
  • 31
  • 2
  • 4

1 Answers1

3

To make this playable in VLC (started on the same machine where your IIS server is) you will need to modify hlssink playlist-root parameter. It should be

... ! hlssink playlist-root=http://localhost ...

This will correctly set prefix URL part of TS segments inside HLS playlist

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

#EXTINF:15.026812553405762,
http://localhost/hlssink.00087.ts
#EXTINF:15.006274223327637,
http://localhost/hlssink.00088.ts
#EXTINF:15.011569976806641,
http://localhost/hlssink.00089.ts
#EXTINF:15.020917892456055,
http://localhost/hlssink.00090.ts
#EXTINF:15.016651153564453,
http://localhost/hlssink.00091.ts

and VLC player will know exact URL(s) to download segments from.

Unfortunately, your HLS is not playable by (most of) browsers because implementation of <video> tag does not support MPEG Transport Stream (MPEG TS) media container that your segments are packed in.

To solve this, you can use, for example, hls.js library which will, among other things, transmux MPEGTS segments into MP4 container supported by standard HTML5 <video> tag.

Dusan Kovacevic
  • 1,377
  • 1
  • 13
  • 19
  • I searched on google for more than a day straight and somehow this post and answer didn't come up at the top. I had VLC playing the hlssink stream successfully, but no browser was able. The explanation about the problems in the browsers with HLS and a link to hls.js library to solve that problem are exactly what I needed. Thanks for this info. – BReddy Jul 22 '20 at 16:45