-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend onvif server to support Unifi Protect #1520
Conversation
|
I used tcpdump to compare go2rtc and a working implementation, 29.97 just happens to be the framerate from the NTSC cameras I have. Bitrate and FPS are displayed in the Unifi Protect web GUI but unclear if exact values are critical to functionality. The RateControl block is required but I didn't test if FPS comes from there or GetVideoSources. I figure those values and more should be configurable, but I didn't see an obvious way to extract the information from a stream/producer object. Unifi Protect also seems unwilling to authenticate over RTSP even when you embed the credentials in the stream uri. I couldn't find where in the onvif spec you're supposed to configure that. The creds are included in each soap request. |
I did some additional testing.
Removing
|
Looking foward this implementation 👀 Thanks @acortelyou |
Thanks! |
Thanks to you @AlexxIT ! Note, I minimized the changes for the purposes of this PR just to get things working. Eventually when multiple onvif servers are implemented it would be great if we could configure Things could get complicated when you have multiple qualities and resolutions per stream eg:
|
Things already complicated, because go2rtc don't know resolution for every stream right now. |
I reviewed #613 and some other issues, but I can't get clear information on how to implement go2rtc via onvif to record cameras from go2rtc in Unifi Protect, since it needs credentials to connect to an onvif server. Setting a pair of creds for the api does not do anything to UP, in Home Assistant though, it works without any, like Alex mentiones many times. Sorry, If it's the wrong place to ask, but this issue seems to have the most accurate intention of getting go2rtc to work with Unifi. |
@blockiindahood I used admin/admin and it worked fine, only thing that I was not able to do is use multiple cameras, so I'm running one instance of go2rtc for each camera. Maybe @acortelyou and @AlexxIT can add a guide how to use multiple cameras at once, but as far I understood it's not possible at the moment |
@BrunoTCouto I also read that currently multi ONVIF Servers aren't supported, and that it's on the todo board. I understand that only one camera is possible, but how do I make it clear to unifi? Also what IP did you fill in? |
@blockiindahood I used the go2rtc IP address. Nothing really fancy on my config. Something like this 👇
|
One thing you should check is, I download the binary directly from the build pipeline, so maybe check if you are in the release of this code, and if it is really deployed already. |
Looking in the logs of go2rtc, I see that Unifi is connecting and trying the credentials, but seems that they are wrong. I am using go2rtc with HASS on an Raspi 4. |
Not sure, logs from where ? go2rtsp or something else? |
Oh, sorry, logs from go2rtc! |
Im without my personal computer to test the release from today. But saw that other changes were made to onvif. Can't help much more as my config was really simple |
Okay, thank you @BrunoTCouto, I'll then must look further into it. |
Maybe try with the binaries from this action. It's the ones I'm using https://github.com/AlexxIT/go2rtc/actions/runs/12549881204/job/34991696663 |
I managed to run UniFi Protect using https://github.com/dciancu/unifi-protect-unvr-docker-arm64 |
Unifi Protect assumes that each ONVIF server you are adopting is a single camera which can have multiple streams (ie LQ/HQ). You must implement one go2rtc server per "camera" you wish to adopt with just one or two streams. Unifi Protect also assumes each ONVIF server will have it's own IP (and maybe MAC). You must also implement an IP per "camera" you wish to adopt. There are many ways to do that but it is highly dependent on your scenario so I won't be able to provide a one size fits all guide. Docker can create virtual interfaces with unique IP/MAC for each container. You might be able to add extra static IPs to your network interface and have each API/ONVIF server only listen on the correct IP/port but I didn't test that. |
@acortelyou were you able to connect at least one camera from go2rtc to UniFi? |
@AlexxIT there is a way to manually add a onvif cam: |
@AlexxIT Yes, I have had five separate go2rtc docker containers using macvlan networking adopted in Unifi Protect on a UDM for several weeks now. I manually adopted them using
|
It might sound dump, but which port did you use? and how did you choose that one? on the host:port in the udm |
@blockiindahood thanks! @acortelyou look like I have broke your PR with removing empty Successfully connected one camera from go2rtc to UniFi Protect. |
@AlexxIT Yes, the I thought I mentioned that but the conversation is split up over multiple issues and the PR... Might be wise to lock this conversation and all ONVIF/Unifi issues except for one. @ALL The version in this PR worked. The current officially released version doesn't work. I suspect that's why there's so many questions/frustration about how to use it. Unifi Protect needs the port of the ONVIF server which is part of the go2rtc |
Two news:
You can add as many cameras as you want from go2rtc to UniFi Protect without any problems:
|
Resolves #613.
Marking draft pending feedback.
Note: Unifi uses appears to use MAC as unique identifier, requiring bridge network to achieve multiple instances