koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.12k stars 247 forks source link

Scrypted causing issues in Unifi Protect #249

Closed pctony closed 2 years ago

pctony commented 2 years ago

Hey folks, firstly want to say thanks for an awesome tool - it has been great.

So. I have been having issues for several weeks now, that I have been debugging with the help of the quite slow Unifi support team. The issue manifests itself as this:

CameraIssues

This would happen to all my cameras, at exactly the same time regardless of them being PoE, Injected PoE, Wifi, etc. Essentially the UNVR was the common factor in all of these issues. Well, after 2 weeks of resetting my UNVR, re-adopting cameras, and so many other pointless steps we finally find issues related to RTSP.

2022-05-08T17:29:03.687Z 3 :202:Accept - Inbound connection accepted: (Far: 192.168.1.163:54992; Near: 192.168.1.2:7441) CTCP(76) <-> TCP(162) <-> ISSL(163) <-> [RTSP(164)] 

2022-05-08T17:29:03.726Z 3 :459:SignalStreamRegistered - Stream ONP(62) with name `68D79AE552E0_0` from protocol RTSP(164) registered to origin application `evostreamms` 

2022-05-08T17:29:10.728Z 1 :194:PerformIO - Unsent output buffer size exceeds threshold 42022-05-08T17:29:10.728Z 1 :423:FeedDataTcp - Unable to send raw rtcp audio data 

2022-05-08T17:29:10.728Z 1 :293:SendRtp - Unable to feed data

As soon as I disabled scrypted.app all of the "camera disconnects" did not re-occur.

Unifi OS: 2.4.8 Unifi Protect: 1.21.6

koush commented 2 years ago

This is a bug with Unifi Protect failing when the RTSP buffer fills due to backpressure. You can try using the HomeKit and rebroadcast betas, and setting your RTSP parser to FFMPEG UDP, so there's no TCP buffering at all. This will just mask the issue though. This is ultimately a Unifi firmware bug.

koush commented 2 years ago

Incidentally you're the only one to ever report this (I've got ~10 cameras myself). But most people are running UDM or UDM pro. I have heard the UNVR is pretty flaky.

pctony commented 2 years ago

Interesting, I have 12 or 13 now (cameras that is). Have been using the UNVR to spread the io load across several platters, and keep the load of the UDMP.

jacobwtyler commented 6 months ago

I think I might be having a similar issue. I have UDM-SE and UNVR and 12 cameras. Running Scrypted on ProxMox server with 10Gbe connection strait to UDMSE and 10gbe connection from UDMSE to UNVR. My network is at an absolute CRAWL right now since adding Scrypted in to the mix. I have Scrypted UniFi plugin restreaming to Frigate and HomeKit for all 12 cameras (Which are all wireless except for one Poe wired strait to UDMSE). Any ideas on how to debug this issue? I found your post because I have a suspicion that maybe some kind of multicast packet setting should be turned on or something to get the restream to go strait to the client that wants it. Frigate, Scrypted and HA are all on the same ProxMox server with direct 10gbe connection and modern specs (intel 13900, GeForce 4070ti, dual pci coral and single usb coral tpu with M.2 Storage for ProxMox NVR). Any help appreciated.

koush commented 6 months ago

there may be a issue with mdns storm. or it could be this, which seems to be a recent issue:

https://www.reddit.com/r/UnifiProtect/comments/1awdtxi/rtsp_and_unifi_protect_a_warning/