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.45k stars 93 forks source link

Issue with livestreaming in HKSV on Unifi Protect Version 6.20.0 #1060

Closed nolan2306 closed 5 months ago

nolan2306 commented 5 months ago

Homebridge UniFi Protect Version

6.20.0

Homebridge Platform and OS

Synology NAS DS918+

Homebridge Version

V1.7.0

Node Version

v20.9.0

UniFi OS Version

3.0.26

UniFi Protect Controller Version

3.2.12

Describe the problem

When I try to stream to my home app in plugin version 6.20.0 it will just sit and spin an never load. Will say camera is not responding. It appears as the snapshots load just fine on the home screen in the home app but can't view a live stream I have rolled back to 6.19.0 for now and live streaming in the home app works as it should.

Homebridge HBUP JSON configuration

{
    "controllers": [
        {
            "address": "unifi.localdomain",
            "username": Redacted
            "password": Redacted
        }
    ],
    "name": "UniFi Protect",
    "platform": "UniFi Protect",
    "options": [
        "Enable.Video.Transcode.Hardware.E43883324A4D",
        "Enable.Video.Stream.Only.High.E43883324A4D",
        "Enable.Audio.Filter.Noise.E43883324A4D",
        "Enable.Device.SyncName.E43883324A4D",
        "Disable.Doorbell.Messages.E43883324A4D",
        "Disable.Log.Doorbell.E43883324A4D",
        "Enable.Video.Transcode.E43883324A4D",
        "Enable.Video.DynamicBitrate.E43883324A4D"
    ],
    "_bridge": {
        "username": "0E:BA:9A:63:BF:11",
        "port": 48616

Relevant log output

[4/12/2024, 6:01:15 PM] [UniFi Protect] Restarting child bridge...
[4/12/2024, 6:01:15 PM] Got SIGTERM, shutting down child bridge process...
[4/12/2024, 6:01:20 PM] [UniFi Protect] Child bridge process ended
[4/12/2024, 6:01:20 PM] [UniFi Protect] Process Ended. Code: 143, Signal: null
[4/12/2024, 6:01:27 PM] [UniFi Protect] Restarting Process...
[4/12/2024, 6:01:27 PM] [UniFi Protect] Launched child bridge with PID 24889
[4/12/2024, 6:01:28 PM] Registering platform 'homebridge-unifi-protect.UniFi Protect'
[4/12/2024, 6:01:28 PM] [UniFi Protect] Loaded homebridge-unifi-protect v6.19.0 child bridge successfully
[4/12/2024, 6:01:28 PM] Loaded 3 cached accessories from cachedAccessories.0EBA9A63BF11.
[4/12/2024, 6:01:28 PM] [UniFi Protect] Using FFmpeg version: 6.0-homebridge-alpine-x86_64-static.
[4/12/2024, 6:01:28 PM] Homebridge v1.7.0 (HAP v0.11.2) (UniFi Protect) is running on port 48616.
Failed to create listener for avahi-daemon server state. The system will not be notified about restarts of avahi-daemon and will therefore stay undiscoverable in those instances. Error message: Error: No such interface found
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Connected to unifi.localdomain (UniFi Protect 3.0.26 running on UniFi OS 3.2.12).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered nvr: Nolan’s Dream Machine Pro [UDM Pro] (address: 10.1.0.9 mac: E43883324A4D).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Garage [G5 Bullet] (address: 10.1.0.216 mac: E438830CAAE9).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Barn [G5 Pro] (address: 10.1.0.59 mac: F4E2C6724F07).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Barn 2 [G5 Pro] (address: 10.1.0.128 mac: F4E2C6724EBD).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Video streaming configured to use only: High.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: Video streaming configured to use only: High.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Video streaming configured to use only: High.
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: HKSV event recording enabled: 3840x2160@30fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: HKSV event recording enabled: 3840x2160@20fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:01:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: HKSV event recording enabled: 2688x1512@30fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:01:40 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 2688x1512@30fps (High), 800 kbps.
[4/12/2024, 6:02:09 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Stopped video streaming session.
[4/12/2024, 6:02:10 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 3840x2160@20fps (High), 800 kbps.
[4/12/2024, 6:02:15 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Stopped video streaming session.
[4/12/2024, 6:02:23 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 3840x2160@20fps (High), 800 kbps.
[4/12/2024, 6:02:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn 2 [G5 Pro]: Stopped video streaming session.
[4/12/2024, 6:02:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 3840x2160@30fps (High), 800 kbps.
[4/12/2024, 6:02:33 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Barn [G5 Pro]: Stopped video streaming session.
[4/12/2024, 6:02:34 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 2688x1512@30fps (High), 800 kbps.
[4/12/2024, 6:02:39 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO] Garage [G5 Bullet]: Stopped video streaming session.
[4/12/2024, 6:13:15 PM] [UniFi Protect] Restarting child bridge...
[4/12/2024, 6:13:15 PM] Got SIGTERM, shutting down child bridge process...
[4/12/2024, 6:13:20 PM] [UniFi Protect] Child bridge process ended
[4/12/2024, 6:13:20 PM] [UniFi Protect] Process Ended. Code: 143, Signal: null
[4/12/2024, 6:13:27 PM] [UniFi Protect] Restarting Process...
[4/12/2024, 6:13:28 PM] [UniFi Protect] Launched child bridge with PID 29016
[4/12/2024, 6:13:28 PM] Registering platform 'homebridge-unifi-protect.UniFi Protect'
[4/12/2024, 6:13:28 PM] [UniFi Protect] Loaded homebridge-unifi-protect v6.20.0 child bridge successfully
[4/12/2024, 6:13:28 PM] Loaded 3 cached accessories from cachedAccessories.0EBA9A63BF11.
[4/12/2024, 6:13:28 PM] [UniFi Protect] Using FFmpeg version: 6.0-homebridge-alpine-x86_64-static.
[4/12/2024, 6:13:28 PM] Homebridge v1.7.0 (HAP v0.11.2) (UniFi Protect) is running on port 48616.
Failed to create listener for avahi-daemon server state. The system will not be notified about restarts of avahi-daemon and will therefore stay undiscoverable in those instances. Error message: Error: No such interface found
[4/12/2024, 6:13:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Connected to unifi.localdomain (UniFi Protect 3.0.26 running on UniFi OS 3.2.12).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered nvr: Nolan’s Dream Machine Pro [UDM Pro] (address: 10.1.0.9 mac: E43883324A4D).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Garage [G5 Bullet] (address: 10.1.0.216 mac: E438830CAAE9).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Barn [G5 Pro] (address: 10.1.0.59 mac: F4E2C6724F07).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Nolan’s Dream Machine Pro [UDM-PRO]: Discovered camera: Barn 2 [G5 Pro] (address: 10.1.0.128 mac: F4E2C6724EBD).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Garage [G5 Bullet]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Garage [G5 Bullet]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn [G5 Pro]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn [G5 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn 2 [G5 Pro]: Syncing Protect device name to HomeKit.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn 2 [G5 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Garage [G5 Bullet]: Video streaming configured to use only: HIGH.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn [G5 Pro]: Video streaming configured to use only: HIGH.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn 2 [G5 Pro]: Video streaming configured to use only: HIGH.
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn [G5 Pro]: HKSV: 3840x2160@30fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:13:29 PM] [UniFi Protect] Barn 2 [G5 Pro]: HKSV: 3840x2160@20fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:13:30 PM] [UniFi Protect] Garage [G5 Bullet]: HKSV: 2688x1512@30fps (High), 2,000 kbps (4 second timeshift buffer).
[4/12/2024, 6:13:41 PM] [UniFi Protect] Garage [G5 Bullet]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 2688x1512@30fps (High), 800 kbps.
[4/12/2024, 6:14:11 PM] [UniFi Protect] Garage [G5 Bullet]: Stopped video streaming session.
[4/12/2024, 6:14:32 PM] [UniFi Protect] Barn [G5 Pro]: Streaming request from 10.1.0.210: 1280x720@30fps, 299 kbps. Transcoding 3840x2160@30fps (High), 800 kbps.
[4/12/2024, 6:15:02 PM] [UniFi Protect] Barn [G5 Pro]: Stopped video streaming session.

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

hjdhjd commented 5 months ago

Thanks for the report. Correlation isn’t causation, in this instance. 😄

You’re running on an underpowered system with fancy cameras that require a lot of horsepower to process. You’re going to run into CPU issues I’m afraid. Disable high-performance snapshots in 6.20.0 and you should see an improvement in your environment.

Some other notes that may be helpful:

TL;DR: working as intended. HBUP is going to consume more CPU in 6.19+ to provide high performance snapshots, you’re on an underpowered system, and you’re forcing HBUP to process more than your environment can handle I suspect.

Disable high performance snapshots, see if it helps.

nolan2306 commented 5 months ago

I was afraid, the bottle neck was the NAS. Just odd to me that on version 6.19.0 everything works fine. I think I am going to move the home bridge instance from the NAS to a Windows VM. The base machine has Intel I5-9500T, and 32gigs of ram. That processor is just leaps and bounds better than the NAS. But, there is more involved to setup via the Windows VM route. Do you see any issues with running with a VM with this hardware. I will allocate as many resources as I can to the VM.

hjdhjd commented 5 months ago

I don't think the difference was in the version, candidly...but rather the number of events you had going on at once. You can revert to traditional snapshots (which work fine, it's just slower and of lower quality due to constraints in the Protect API), and you should be back to where you were by and large.

I wouldn't run this on a Windows VM...I've done it myself, and it has its own issues. For instance, you can't take advantage of hardware acceleration because of a Windows limitation, ostensibly for security reasons, where you can't access the GPU for hardware acceleration if you're running as a system service. That instantly makes it much less appealing.

Your best bet: get a Mac mini. Even the cheapest Mac mini is going to run circles around most of these systems with respect to this use case. They are relatively inexpensive, especially if you get a refurb. If you go down the Mac route, don't run it in a VM. Run it natively, with hardware acceleration, and be impressed and happy with the performance. 😄 I myself do this...and also run a bunch of other CPU-intensive stuff in my environment. The Mac never breaks a sweat.

Other alternatives...you can try a Raspberry Pi 4 (not 5...I'm not supporting that one quite yet). Should be more performant than what you have, but it's a very low power system too.

Best of luck! Best of luck!

github-actions[bot] commented 5 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.