home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.46k stars 29.4k forks source link

UniFi Protect video delay #67888

Closed NVader2000 closed 2 years ago

NVader2000 commented 2 years ago

The problem

Streaming video is massively delayed (e.g. 20-30 second) and is extremely choppy.

What version of Home Assistant Core has the issue?

2022.3.3

What was the last working version of Home Assistant Core?

Unsure, but was working using RTSPS when that was supported

What type of installation are you running?

Home Assistant Core

Integration causing the issue

unifiprotect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifiprotect

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Purchased, per the recommendation of UniFi, a Western Digital Purple hard drive (type CMR). Video in the native UnIfi Protect app is super smooth and without any noticeable delay. However, the HA integration is delayed, a lot. There also does not appear to be a way to adjust the resolution of the video. IT is always labeled 'High', which might be the cause. The RTSPS option seemed better when it was working, I think version 1.4 of the HACS repo which is now deprecated.

probot-home-assistant[bot] commented 2 years ago

unifiprotect documentation unifiprotect source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @briis, @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

AngellusMortis commented 2 years ago

The UniFi Protect integration is not responsible for streaming. It only provides the data needed for the stream integration to work.

https://www.home-assistant.io/integrations/unifiprotect#delay-in-video-feed https://www.home-assistant.io/integrations/stream/#ll-hls

NVader2000 commented 2 years ago

Fair enough. However, this only happens with HA. I have tried other platforms without issue. One thing I noticed is the Sensor list shows 'Low' and 'Medium' as being unavailable. I am thinking that the higher resolution might be causing some of choppiness. How can I make these available?

image

AngellusMortis commented 2 years ago

Read the docs I linked above. The delay is because you are likely using HLS. HLS is really bad for livestream and add a delay to the feed because of how it generating the keyframes works.

NVader2000 commented 2 years ago

Yeah, try that. Took the example and added it to my .yaml and no difference. Any thoughts on the 'Unavailable' Low/Medium?

NVader2000 commented 2 years ago

What kills me, this was working just fine prior to the official integration.

AngellusMortis commented 2 years ago

If you tried that, then the problem is on your end with your configuration and how you have the stream integration setup.

Because, again, as I said before the UniFi Protect Integration does not handle streaming. There is literally zero difference in how the official integration sets up configures camera entities now in the official integration and 0.11 of the HACS integration. The only difference compared to 0.10 of the HACS integration is that all camera channels are exposed as entities instead of just the highest enabled quantity. If you made no changes between 0.10 and the official integration to your enabled camera channels, HA is still using the same ones for streaming.

The stream integration has made a number of recent changes including LL HLS attempted to be enabled by default in 2022.2 (the same version the UniFi Protect Integration was made official). If you are having issues with streaming, you need to reach out to the maintainers of that integration because I do not know much beyond "it works on my machine".