hjdhjd / homebridge-unifi-protect

:video_camera: Complete HomeKit integration for all UniFi Protect device types with full support for most features including HomeKit Secure Video, and more. https://homebridge.io
Other
1.39k stars 84 forks source link

Multiple cameras with Apple TV stops and restarts streams #1051

Closed dknappett closed 3 months ago

dknappett commented 3 months ago

Homebridge UniFi Protect Version

6.16.0

Homebridge Platform and OS

Ubuntu 20.04.6 LTS

Homebridge Version

1.7.0

Node Version

18.19.0

UniFi OS Version

3.1.16

UniFi Protect Controller Version

2.10.10

Describe the problem

I have multiple Unifi cameras configured (plus a non-unifi camera) all showing in HomeKit. When I view them on an Apple TV, I bring up the preview screen that shows a live feed of all the cameras. I can see in the Homebridge logs that a stream for each camera starts. If I select a camera, the live feed for that camera shows full screen. At that point, streams for other camera stops (as expected). The camera that I'm viewing full screen continues for a few seconds, but then also stops. The camera live feed shows 'No response' in tvOS, but then if I leave it, 30 seconds later a new stream is started automatically and works as expected.

If I disable other Unifi camera, leaving only 1 active, when I view the preview or cameras I see the stream start in Homebridge. When I select to view that remaining Unifi camera full screen, the stream never stops and restarts in this case. The issue only happens when I have multiple Unifi cameras enabled.

I'm running tvOS 17.4, but this has been happening for a while on previous tvOS versions. This issue doesn't happen when using iOS or macOS as only a snapshot image is used for the preview, not a live stream.

Homebridge HBUP JSON configuration

{
    "controllers": [
        {
            "address": "192.168.10.1",
            "password": "PASSWORD",
            "username": "USERNAME"
        }
    ],
    "name": "UniFi Protect",
    "options": [
        "Disable.Audio.TwoWay.<MAC>",
        "Disable.Doorbell.Messages.<MAC>",
        "Disable.Log.Doorbell.<MAC>",
        "Disable.Log.HKSV.<MAC>",
        "Enable.Device.<MAC>",
        "Disable.Audio.TwoWay.<MAC>",
        "Enable.Device.SyncName.<MAC>",
        "Disable.Log.Doorbell.<MAC>",
        "Disable.Log.HKSV.<MAC>",
        "Disable.Device.<MAC>",
        "Disable.Audio.<MAC>",
        "Disable.Log.Doorbell.<MAC>",
        "Disable.Log.HKSV.<MAC>",
        "Disable.Video.Transcode.Hardware.<MAC>",
        "Disable.Video.Transcode.HighLatency.<MAC>",
        "Disable.Log.Doorbell.<MAC>",
        "Disable.Log.HKSV.<MAC>",
        "Disable.Video.Transcode.HighLatency.<MAC>",
        "Disable.Video.Transcode.HighLatency.<MAC>",
        "Disable.Video.Transcode.HighLatency.<MAC>"
    ],
    "platform": "UniFi Protect"
}

Relevant log output

[25/03/2024, 10:00:40] [UniFi Protect] UDM Pro [UDM-PRO] Garage [G4 Instant]: Streaming request from 192.168.10.90: 1920x1080@30fps, 802 kbps. Using 2688x1512@30fps (High), 5,000 kbps.
[25/03/2024, 10:00:40] [UniFi Protect] UDM Pro [UDM-PRO] Front Driveway [G5 Flex]: Streaming request from 192.168.10.90: 1920x1080@30fps, 802 kbps. Using 2688x1512@30fps (High), 10,000 kbps.
[25/03/2024, 10:00:46] [UniFi Protect] UDM Pro [UDM-PRO] Front Driveway [G5 Flex]: Stopped video streaming session.
[25/03/2024, 10:00:51] [UniFi Protect] UDM Pro [UDM-PRO] Garage [G4 Instant]: Stopped video streaming session.
[25/03/2024, 10:01:21] [UniFi Protect] UDM Pro [UDM-PRO] Garage [G4 Instant]: Streaming request from 192.168.10.90: 1920x1080@30fps, 802 kbps. Using 2688x1512@30fps (High), 5,000 kbps.
[25/03/2024, 10:01:31] [UniFi Protect] UDM Pro [UDM-PRO] Front Driveway [G5 Flex]: Streaming request from 192.168.10.90: 1920x1080@30fps, 802 kbps. Using 2688x1512@30fps (High), 10,000 kbps.
[25/03/2024, 10:01:34] [UniFi Protect] UDM Pro [UDM-PRO] Front Driveway [G5 Flex]: Stopped video streaming session.
[25/03/2024, 10:01:34] [UniFi Protect] UDM Pro [UDM-PRO] Garage [G4 Instant]: Stopped video streaming session.

Acknowledgment that you are only running UniFi OS and UniFi Protect releases from the Ubiquiti Official release channel

hjdhjd commented 3 months ago

Thanks for the report. None of these are issues with HBUP, but rather bugs in tvOS. I experience similar things at times…there’s not much to be done here from an HBUP perspective. You can mitigate it, if you choose to transcode in all cases. For local streaming, you can select the feature option to transcode in all circumstances and that should do the trick and significantly alleviate the issue.

TL;DR: tvOS bugs. It can’t handle the quality level of a UniFi Protect camera and really wants a lower quality transcoded stream. Some versions of tvOS are more capable than others at handling it.

github-actions[bot] commented 3 months ago

This issue is locked to prevent necroposting on closed issues. Please create a new issue for related support requests, bug reports, or feature suggestions.