HLS streaming not working reliably #408
-
First of all, I'm not sure if I'm missing something and can't pinpoint the exact problem (not being familiar with HLS), so I'd like to ask:
Basically, I have the default config with a sample rtsp source (but also tried a few live IP cameras), and access paths:
test:
source: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
sourceOnDemand: false
sourceProtocol: tcp I could never view a continuous stream for at least 1 minute:
There doesn't appear to be something obviously wrong in the logs, except the
Since HLS is just http, I don't think that running inside a Docker container is relevant at all, but thought I'd mention anyway. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hello, first of all i'd like to clarify a couple of things about HLS. HLS works by generating files, that can be served with a standard HTTP server. These files are:
Second thing to keep in mind: desktop browsers don't support HLS natively. They support it by using libraries like hls.js that basically unwrap tracks from the TS container, wrap them again in fMP4 and append this fMP4 chunk to a <video> element by using the Media Source Extensions API.
The server must wait for an I-Frame to appear, then it can start producing a segment, then it must wait for another I-Frame to appear to finalize the current segment and send it to a client. rtsp-simple-server don't re-encode the stream, therefore the I-Frame interval is fixed and dictated by the source (camera, file or other server). It can vary from 1 second to 60 seconds. Therefore, this issue depends largely on the original stream. If the stream causes too much problems, you can choose to re-encode it with a fixed I-frame interval before sending it to the server.
An improvement consists in editing the server to block HLS client requests until at least 2-3 segments are ready to be served. The cons is that this increases delay and again depends on the I-Frame interval.
Browsers don't support live streams natively (except iOS Safari), they support only standard videos, that are seekable. As i explained above, HLS libraries allow to support live streams by appending video chunks to a video element, one after the other. This is the reason why the video appears seekable. To solve the issue, you can use a HLS library of your choice (most of them hide the seek bar) and load the HLS URL provided by the server. |
Beta Was this translation helpful? Give feedback.
-
OK I think I've identified the issue preventing smooth playing: #418 |
Beta Was this translation helpful? Give feedback.
-
I see that content-type for stream.m3u8 is |
Beta Was this translation helpful? Give feedback.
-
With respect to all the issues and enhancements listed here, some of them have been dealt with, some of them are still WIP. I think it's better to discuss each problem in a dedicated issue. |
Beta Was this translation helpful? Give feedback.
With respect to all the issues and enhancements listed here, some of them have been dealt with, some of them are still WIP. I think it's better to discuss each problem in a dedicated issue.