Curtis Bezault
Curtis Bezault

Reputation: 63

low-latency html5 video on a LAN

I'm looking for some suggestions on how to use the tag to stream a live-video stream with relatively low latency (~2s). I've seen some other questions similar to this posted such as this and this but neither really adequately answered my question. The first one is working under the assumption that the content consumers will not be on site. The second also seems to make that assumption.

I'm looking for technologies, libraries or any suggestions really to achieve this. I've experimented with nginx-RTMP to receive streams from video devices and then using HLS to send it to the browser. The lowest latency I've been able to achieve with this however was ~4s. I haven't gotten around to working with DASH and I found this paper that describes using it for low-latency in a similar setup to mine but I wanted some opinions before I got started in trying that.

I understand that solutions such as gstreamer do exist and I've gotten latency of around 200ms measured using GPAC tools but having users download things is not really an option I can pursue (the site of the LAN setup won't have internet, cellular or otherwise, at all).

edit 1:

I'm not working at massive scale at all. At most there will be 200 users all of which will connect to the LAN via wifi. The reason I need low latency is that the goal of the project is to provide users better views of the event they are at. The actual viewpoints are pretty bad.

Upvotes: 4

Views: 2788

Answers (1)

Brad
Brad

Reputation: 163272

You won't achieve low latency with any of the segmented distribution methods (HLS, DASH, or similar). The very nature of these protocols is that the data is chunked into relatively large pieces. 4 seconds with HLS is amazingly low, and with chunks that small you have quite a bit of overhead... a waste of bandwidth and not really HLS and DASH are good for.

The first one is working under the assumption that the content consumers will not be on site.

My answer there (https://stackoverflow.com/a/37475943/362536) doesn't assume that the consumers will not be on your site... that's not the case at all. What I'm suggesting there is that you take advantage of YouTube and embed their viewer when low latency isn't needed, saving you mountains of money.

If all of your viewers require low latency video to make this work, you're going to have to get crafty on the server side. If you told us what sort of scale you were working with, perhaps we could suggest something more specific. Since you didn't, let's focus on the possibilities client-side.

WebRTC is one of the best options. Everything in the whole WebRTC stack is built with low latency in mind. With WebRTC, you can get those sub-second latencies in normal operation. Note that aren't a lot of good choices for streaming servers that support WebRTC today.

You can also use Media Source Extensions and Web Sockets. This gives you quite a bit of control and allows very fast streaming of data to the clients, at a slightly higher cost of latency. It's much easier to do this than it is to implement your own server-side WebRTC that supports media streams.

I strongly recommend reading over my answer on that other question again as well. There are a lot of considerations here... make very sure that this low latency is actually worth the reduction in quality and the financial costs involved. This is rarely the case, expecially for 10s of thousands of users or more.

Upvotes: 5

Related Questions