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

Issue with streaming on iOS #993

Closed joshuahaber closed 1 year ago

joshuahaber commented 1 year ago
/service. **Describe The Problem:** Hey guys, I updated to the latest version of your plugin (6.15). After the update, streaming in homekit does not work. When I go and view the logs in the server, this is what I get. It appears there is an unrecognized switch passed. I looked through the settings and I cannot find this. I've restarted the server **To Reproduce:** Open homekit on multiple devices and try to view camera stream. **Logs:** ``` NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: FFmpeg process ended unexpectedly with an exit code of 1. [10/6/2023, 8:20:20 AM] [homebridge-unifi-protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: FFmpeg command line that errored out was: ffmpeg -hide_banner -nostats -fflags +discardcorrupt -probesize 16384 -max_delay 500000 -r 24 -rtsp_transport tcp -i rtsps://IP:7441/sxAfJuMNSZJhs5wL?enableSrtp -map 0:v:0 -c:v libx264 -preset veryfast -profile:v main -level:v 4.0 -noautoscale -bf 0 -filter:v format=yuvj420p, scale=-2:min(ih\,720) -g:v 48 -bufsize 598k -maxrate 363k -crf 20 -payload_type 99 -ssrc 13379308 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 7QjJz8/1o5BJUj3gJsUFvUjlwPbN0G1Y+pwxdFUN srtp://IP:60353?rtcpport=60353&pkt_size=564 -map 0:a:0? -acodec libfdk_aac -afterburner 1 -eld_sbr 1 -eld_v2 1 -profile:a 38 -flags +global_header -f null -ar 24k -b:a 24k -bufsize 48k -ac 1 -payload_type 110 -ssrc 6826346 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params d1sx8o73WGmXA2m02K7jwaLWG1j8z76dLOr17tCl srtp://IP:57741?rtcpport=57741&pkt_size=188 [10/6/2023, 8:20:20 AM] [homebridge-unifi-protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: Unrecognized option 'noautoscale'. [10/6/2023, 8:20:20 AM] [homebridge-unifi-protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: Error splitting the argument list: Option not found ``` **Homebridge Configuration:** ``` { "controllers": [ { "address": "", "password": "", "username": "" } ], "options": [ "Enable.Motion.SmartDetect.74ACB91BC51A", "Enable.Video.DynamicBitrate.74ACB91BC51A", "Enable.Video.Transcode.Hardware.74ACB91BC51A", "Enable.Video.Transcode.74ACB91BC51A", "Enable.Device.SyncName.74ACB91BC51A" ], "_bridge": { "username": "0E:BC:CD:1D:EE:8D", "port": 44701 }, "platform": "UniFi Protect" }, ``` **Screenshots:**

Environment:

hjdhjd commented 1 year ago

Thanks for the report.

Your issue is hardware acceleration. Disable it in the HBUP webUI...as stated, hardware acceleration is a new feature, and I'm gathering feedback before making it more generally available by default. Once you've done that, things should work just fine.

Also - please completely fill out the environment details, I generally will not provide support without a completely filled out support template.

Best of luck.

joshuahaber commented 1 year ago

Sorry, I missed the version on the homebridge plugin! I must have missed the copy.

It looks like I don't have that selected.

image
hjdhjd commented 1 year ago

You do, in your options above that you included. It's set at the controller level, I would guess. But assuming the above is accurate, you definitely do:

            "options": [
                "Enable.Motion.SmartDetect.74ACB91BC51A",
                "Enable.Video.DynamicBitrate.74ACB91BC51A",
                "Enable.Video.Transcode.Hardware.74ACB91BC51A",
                "Enable.Video.Transcode.74ACB91BC51A",
                "Enable.Device.SyncName.74ACB91BC51A"
            ],

PS: General advice: do not enable options that you don't actually need (e.g. dynamic bitrate). The defaults are almost always right for almost everyone unless you have specific use cases.

joshuahaber commented 1 year ago

OK, is it the transcode hardware option? If so, I removed that line and restarted. I’m still getting the same error. Anything else I should remove?

Josh Haber [signature_2690772847] T: 318.317.0682 @.**@.> - www.newrockit.comhttp://www.newrockit.com/ NEWROCKIT, LLC [facebook icon]https://facebook.com/newrockit [twitter icon] https://www.twitter.com/newrockit [Banner]https://www.newrockit.com/

From: hjdhjd @.> Date: Friday, October 6, 2023 at 9:48 AM To: hjdhjd/homebridge-unifi-protect @.> Cc: Josh Haber @.>, Author @.> Subject: Re: [hjdhjd/homebridge-unifi-protect] Issue with streaming on iOS (Issue #993)

You do, in your options above that you included. It's set at the controller level, I would guess. But assuming the above is accurate, you definitely do:

        "options": [

            "Enable.Motion.SmartDetect.74ACB91BC51A",

            "Enable.Video.DynamicBitrate.74ACB91BC51A",

            "Enable.Video.Transcode.Hardware.74ACB91BC51A",

            "Enable.Video.Transcode.74ACB91BC51A",

            "Enable.Device.SyncName.74ACB91BC51A"

        ],

— Reply to this email directly, view it on GitHubhttps://github.com/hjdhjd/homebridge-unifi-protect/issues/993#issuecomment-1750809459, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAJ3D4FWKWHPKY2JVAQCTGDX6AK4PAVCNFSM6AAAAAA5V3EQNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJQHAYDSNBVHE. You are receiving this because you authored the thread.Message ID: @.***>

joshuahaber commented 1 year ago

OK, is it the transcode hardware option? If so, I removed that line and restarted. I’m still getting the same error. Anything else I should remove?

hjdhjd commented 1 year ago

What hardware are you running on? And if you restarted and are getting the same error message, please post the logs showing the errors, once you've restarted...as well as the HBUP startup logs. Thanks.

joshuahaber commented 1 year ago

I'm running a Mac pro with vmware.

NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: FFmpeg process ended unexpectedly with an exit code of 1.
[10/6/2023, 11:12:19 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: FFmpeg command line that errored out was: ffmpeg -hide_banner -nostats -fflags +discardcorrupt -probesize 16384 -max_delay 500000 -r 24 -rtsp_transport tcp -i rtsps://IP:7441/XzMjuMg50ky7qb4j?enableSrtp -map 0:v:0 -c:v libx264 -preset veryfast -profile:v main -level:v 4.0 -noautoscale -bf 0 -filter:v format=yuvj420p, scale=-2:min(ih\,720) -g:v 48 -bufsize 598k -maxrate 363k -crf 20 -payload_type 99 -ssrc 654265 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params +VDBQj2lYoapHfLdBfrNwf263XAAVYboILh2Du+G srtp://10.0.4.23:63624?rtcpport=63624&pkt_size=564 -map 0:a:0? -acodec libfdk_aac -afterburner 1 -eld_sbr 1 -eld_v2 1 -profile:a 38 -flags +global_header -f null -ar 24k -b:a 24k -bufsize 48k -ac 1 -payload_type 110 -ssrc 8292796 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 25YwEKzMpIrVLFzUVHEm0K/xhY7v4ne6hQ+5PBlA srtp://10.0.4.23:64270?rtcpport=64270&pkt_size=188
[10/6/2023, 11:12:19 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: Unrecognized option 'noautoscale'.
[10/6/2023, 11:12:19 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: Error splitting the argument list: Option not found

Is this what you need?

[10/6/2023, 11:11:39 AM] [UniFi Protect] Loaded homebridge-unifi-protect v6.15.0 child bridge successfully
[10/6/2023, 11:11:39 AM] Loaded 6 cached accessories from cachedAccessories.0EBCCD1DEE8D.
[10/6/2023, 11:11:39 AM] [Govee] [LAN] client enabled and found 0 device(s).
[10/6/2023, 11:11:39 AM] Homebridge v1.6.1 (HAP v0.11.1) (UniFi Protect) is running on port 44701.
[10/6/2023, 11:11:40 AM] [homebridge-sense-power-meter] This plugin generated a warning from the characteristic 'Current Ambient Light Level': characteristic was supplied illegal value: number 0 exceeded minimum of 0.0001. See https://homebridge.io/w/JtMGR for more info.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered nvr: NEWROCKIT SECURITY APPLIANCE [UDM Pro] (address: 10.0.0.1 mac: 74ACB91BC51A).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Front Camera 1 [G4 Pro] (address: 10.0.0.152 mac: 74ACB901300F).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Back Camera 2 [G4 Pro] (address: 10.0.0.142 mac: 74ACB9013142).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Side Door [G4 Doorbell] (address: 10.0.0.153 mac: E063DAEFFB3D).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Front Door [G4 Doorbell] (address: 10.0.0.73 mac: D021F9998AED).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Front Camera 2 [G4 Pro] (address: 10.0.0.53 mac: 74ACB9012F64).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE: Discovered camera: Back Camera 1 [G4 Pro] (address: 10.0.0.16 mac: E063DAEF501D).
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: Smart motion detection enabled: person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 1 [G4 Pro]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 2 [G4 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 2 [G4 Pro]: Smart motion detection enabled: person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 2 [G4 Pro]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Side Door [G4 Doorbell]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Side Door [G4 Doorbell]: Smart motion detection enabled: package, person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Side Door [G4 Doorbell]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Door [G4 Doorbell]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Door [G4 Doorbell]: Smart motion detection enabled: package, person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Door [G4 Doorbell]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: Smart motion detection enabled: person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Front Camera 2 [G4 Pro]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 1 [G4 Pro]: Dynamic streaming bitrate adjustment on the UniFi Protect controller enabled.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 1 [G4 Pro]: Smart motion detection enabled: person, vehicle.
[10/6/2023, 11:11:41 AM] [UniFi Protect] NEWROCKIT SECURITY APPLIANCE [UDM-PRO] Back Camera 1 [G4 Pro]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera.
AlexF090 commented 1 year ago

Do you have two-factor authentication enabled on Unifi? I get it because of the two lines:

[10/6/2023, 11:11:39 AM] Loaded 6 cached accessories from cachedAccessories.0EBCCD1DEE8D.
[10/6/2023, 11:11:39 AM] [Govee] [LAN] client enabled and found 0 device(s).
joshuahaber commented 1 year ago

I do, but not for that account. Govee is a lighting accessory.

joshuahaber commented 1 year ago

I think I figured it out. I believe it's one of these options.

image
hjdhjd commented 1 year ago

It's neither. Your issue is FFmpeg-related, and should be addressed a bit more completely in an upcoming release. Thanks for the report. You're welcome to downgrade one version in the Homebridge webUI and it should resolve your issue in the meantime. Thanks for the report.

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