QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
250 stars 41 forks source link

Use go2rtc instead of gstreamer? #185

Closed chris24walsh closed 2 months ago

chris24walsh commented 8 months ago

Please forgive my ignorance to the inner workings of Neolink, and indeed go2rtc. But, as I understand, go2rtc is perfect for restreaming. So, assuming it was not prohibitively difficult/effortful, would go2rtc provide a better engine for the RTSP restream?

There are a few advantages, from my perspective. In my case, and I'm sure many others, I already run go2rtc natively from Frigate and pass the Neolink streams into it for detection and livestreaming in Home Assistant, which consumes extra resources over having just one streaming engine. Go2rtc also seems to really be the leader of the pack in this area, well supported and new features all the time. Primarily, in my mind, the ability to handle 2-way/backchannel audio. It used to be just ONVIF profile T compatible cameras supported, but it now also supports a few other types (including Roborock vacuum's cameras! 2-way audio!!)

Please enlighten me whether this is even possible or desirable, or if you've already considered this (I'm presuming you have).

chris24walsh commented 8 months ago

I came across this project which utilises go2rtc to restream Eufy non-RTSP cameras, which prompted my question here: https://github.com/oischinger/eufyp2pstream/tree/main

QuantumEntangledAndy commented 2 months ago

As I understand it go2rtc is an application not a library. Theres no way for me to link against it directly. Go2rtc is also written in go not rust so I would need an FFI layer just like we do already for gstreamer. I think you are not understanding what is going on here. Reading your linked program it does a simplified version of what we already do. It connects to the camera and pipes the video into a tcp socket. Then it asks you to pull the frames from that socket through go2rtc. In neolink rather then exposing the raw frames on a tcp socket we put it though a minimal gstreamer pipeline to create a rtsp stream. We also handle buffering and reconnects.