beele / homebridge-unifi-protect-camera-motion

Camera & Motion sensor support for Unifi Protect cameras in Homekit via Homebridge
Apache License 2.0
103 stars 12 forks source link

Incorrect Aspect Ratio for Doorbell Snapshot #70

Closed shnhrrsn closed 2 years ago

shnhrrsn commented 3 years ago

The G4 Doorbell is 1600x1200 (4:3) — it looks like snapshots are being forced to 1280x720 (16:9) regardless of device type so they appear stretched in Home.app.

JJJ commented 3 years ago

I noticed this, too. Not only the snapshot, but the video feed as well.

I'm not certain if this is configurable. I half assumed HomeKit always used 16:9 for everything.

beele commented 3 years ago

I'll try and see if it's possible, I would assume that it would just display the stream/snapshot as is, but ffmpeg can probaly be set to letter/pillarbox the video/photo

beele commented 3 years ago

The latest beta: homebridge-unifi-protect-camera-motion@0.4.3-beta.3 has some changes in the way video & snapshots are handled. sudo npm i -g homebridge-unifi-protect-camera-motion@0.4.3-beta.3 --unsafe-perm=true

The video config section for the plugin should be adjusted to this:

"videoConfig": {
    "audio": true,
    "maxFPS": 30,
    "maxBitrate": 3000
}
JJJ commented 3 years ago

Testing 0.4.3 beta 3 here, no change:

Feed

jjj-sc-2020-08-23 at 22 36 06@2x

Thumbnails

jjj-sc-2020-08-23 at 22 36 56@2x

My config already had those keys set, plus others. Are you saying to remove everything else? Here's mine:

"videoConfig": {
    "vcodec": "h264_omx",
    "audio": true,
    "maxStreams": 3,
    "maxWidth": 3840,
    "maxHeight": 2160,
    "maxFPS": 60,
    "mapvideo": "0:1",
    "mapaudio": "0:0",
    "maxBitrate": 3000,
    "packetSize": 376,
    "additionalCommandline": "-protocol_whitelist https,crypto,srtp,rtp,udp -loglevel verbose"
}
beele commented 3 years ago

@JJJ You should try with only the small videoConfig like the one I posted above.

JJJ commented 3 years ago

@beele holy moly that is a HUGE improvement.

Feed

jjj-sc-2020-08-24 at 12 15 53@2x

Thumbnails

jjj-sc-2020-08-24 at 12 16 21@2x
JJJ commented 3 years ago

First weird new error in homebridge logs.

53FD9F8C-6498-420D-AEC1-14A3742BA7C6

beele commented 3 years ago

I have a fix for that issue coming up, the strange thing is that I don't get that error. Are any of your cameras off (or disconnected, or....)? I have one camera that is mostly off but I still get a snapshot from the protect url (be it an older image off when it was last on and queried for a snapshot)

beele commented 3 years ago

@JJJ Can you try with: sudo npm i -g homebridge-unifi-protect-camera-motion@0.4.3-beta.4 --unsafe-perm=true

JJJ commented 3 years ago

Will test today and report back.

It's plausible that the cameras or UDM Pro rebooted (like after updates?) but they were all online and functioning at the time of the error. I could access them fine via the official protect app, but not via Home.

JJJ commented 3 years ago

@beele so far, so good.

JJJ commented 3 years ago

@beele unsure if related, but I've had it happen twice today where video & snapshots simply stop responding.

Last night, Unifi Protect updated to 1.14.12-beta.3, which may also be contributing. Since I have no facts, this is simply to report what I'm seeing, and I'll update as I learn more.

I do know that restarting Homebridge and closing/opening the Home app on the relative device(s) makes video & snapshots work again.

beele commented 3 years ago

@JJJ Can you try with the latest beta, I've reworked how video streams are handled. sudo npm i -g --unsafe-perm=true homebridge-unifi-protect-camera-motion@0.4.3-beta.8