brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
925 stars 141 forks source link

Rotating camera image #22

Closed G60GT closed 5 years ago

G60GT commented 5 years ago

I'd love to have the ability to rotate the camera image by 180° (90° and 270° might also be useful under certain circumstances). It doesn't have to be a UI option (if that's possible at all), some kind of parameter in a config file would suffice.

Background: my rPi has to be mounted upside down for cabling reasons.

looxonline commented 5 years ago

+1 to this. I need to mount mine upside down too.

pieter commented 5 years ago

You can rotate the image by running this on startup:

v4l2-ctl --set-ctrl=rotate=180

G60GT commented 5 years ago

Where would I put that to be executed on startup?

brutella commented 5 years ago

Put it into the /etc/sv/hkcam/run script just before hkcam binary is executed.

#!/bin/sh -e
exec 2>&1
v4l2-ctl --set-ctrl=rotate=180
exec hkcam --data_dir=/var/lib/hkcam/data --verbose=true
looxonline commented 5 years ago

Legend! Thanks.

G60GT commented 5 years ago

Works like a charm. Thank you very much!

Just for the record: I guess, 90 and 270 would work also? Maybe every value between 1 and 359?

brutella commented 5 years ago

I've only tried a value of 90 and 180, but I guess 270 will also work. 45 didn't work for me though.

G60GT commented 5 years ago

Wouldn't be very efficient anyway, putting a rectangle (video image) inside another rectangle (viewport) in angles different from n*90° …