scottlamb / moonfire-nvr

Moonfire NVR, a security camera network video recorder
Other
1.22k stars 137 forks source link

FTL for streaming? #108

Closed IronOxidizer closed 3 years ago

IronOxidizer commented 3 years ago

Are there any plans to use the FTL protocol to potentially reduce latency even further? Maybe similar to something along the lines of Project Lightspeed?

scottlamb commented 3 years ago

Where would FTL fit in? Moonfire NVR talks directly with cameras (which support RTSP and perhaps RTMP, not FTL) and browsers (which support WebSocket and WebRTC, not FTL) today. I don't have any plans to add intermediaries.

Even the basic live view is still under development (#59); the server half is committed but the client half is not. It does seem to more or less work; I think the biggest contributors to latency right now are:

In total the delay with Moonfire NVR's live view on the browser seems pretty similar to using VLC to talk directly to the camera.

IronOxidizer commented 3 years ago

I was thinking potential future clients other than browsers (desktop app, mobile app) could leverage FTL. Seeing as that's probably out of scope for now, I'll close this issue.

scottlamb commented 3 years ago

Ahh, yeah, that's certainly possible. I've thought about adding RTSP relay support but don't have any immediate plans for it, much less FTL. If you'd like to contribute support, though, I'd be happy to help you learn the codebase and fit it into the design.

IronOxidizer commented 3 years ago

buffering in the browser. Switching to WebRTC might help; I also am keeping an eye on WebCodecs.

Speaking of WebRTC, it might be worth investigating a serverless (TURN/STUN) implementation to reduce latency. I have a small demo of this here: https://github.com/IronOxidizer/serverless-webrtc-rust

scottlamb commented 3 years ago

My current approach is to assume you can set up port forwarding to expose Moonfire NVR to the Internet. Docs here. So there's no intermediary causing extra latency.

It'd be nice to use NAT traversal to make installation easier (in general) and possible for folks behind Carrier Grade NAT (not sure how common that is but I know it exists), but no one's complained about it so far, and I have a lot of other improvements I want to make to Moonfire NVR.