NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

[Feature]: scale camera still images based on source #465

Open crxporter opened 2 years ago

crxporter commented 2 years ago

Your Current NRCHKB Plugin Version

1.4.3

Operating System

Pi buster

What is your idea?

Currently all still camera images are scaled to the size requested by iOS. Suggestion is to use the aspect ratio of the input image.

My stills are 1600x1200 (4:3 ratio) but are squished to 16:9 ratio.

Any more details?

I believe this can be changed on this like of code:

https://github.com/NRCHKB/node-red-contrib-homekit-bridged/blob/d96c745dfc18032e49d16ead525a2eb751db83d6/src/lib/cameraSource/index.js#L170

Additional comments?

Still image screenshot (squished): 92A12C60-5A9D-415C-B4FC-73F1E5764ADC

streaming view (proper scale): 1AC26E0D-6CBD-497D-9804-66A4BE92825F

Any code or functions to add?

No response

crxporter commented 2 years ago

Related to this:

https://github.com/beele/homebridge-unifi-protect-camera-motion/issues/70

crxporter commented 2 years ago

After more research... scaling would not help here. The still image needs to be cropped down to a 16:9 ratio, centered at 50% of the still image height or width (whichever needs to be cropped).

In my case I was hoping to change the still image source from:

-i http://10.0.1.3/snap.jpeg

to:

-i http://10.0.1.3/snap.jpeg -vf "crop=1600:900:0:150"

Which would output a proper image - but it doesn't seem to be working ... there must be something conflicting with that ffmpeg command later on in the code.