Closed La-te closed 2 years ago
I haven't tested it on Buster yet.
@La-te I went through a manual install on Stretch, and my notes are here. I'm sure it's not identical but the installation is straightforward enough that, as long as the packages exist for Buster, I doubt it'll cause any problems.
@La-te I went through a manual install on Stretch, and my notes are here. I'm sure it's not identical but the installation is straightforward enough that, as long as the packages exist for Buster, I doubt it'll cause any problems.
Attempting to install it on Buster according to your notes, it won't install v4l2loopback
, tried a workaround by installing it in a different way, but then I get the modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/4.xxxxx
error.
I'm too much of a n00b to figure this out on my own, any clues on what I could do to get it working?
See #90 for the changes I did.
Running on Raspberry Pi Zero W, with Buster!!
Hereby my detailed instructions:
_Bases on Robert Carpenter's installation with a few changes/additions:_
1 Preparations:
ssh pi@ip-address
2 Change basic settings:
sudo raspi-config
ssh pi@ip-address
sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y
sudo reboot
3 Before you go any further be sure your camera is working! If not resolve this first:
ssh pi@ip-address
raspistill -o test.jpg
sudo apt install fswebcam
fswebcam test.jpg
You might need to add “dwc_otg.fiq_fix_enable” in /boot/cmdline.txt
sudo nano /boot/cmdline.txt
- add
dwc_otg.fiq_fix_enable
followed by ctrl-x, y, Enter
4 If camera is working, than install the following:
sudo apt install raspberrypi-kernel-headers
sudo apt install v4l2loopback-dkms
v4l2-ctl --list-devices
will list your videodevices, look for your camera device, should be /dev/video0.echo 'options v4l2loopback video_nr=0' | sudo tee -a /etc/modprobe.d/v4l2loopback.conf
sudo modprobe v4l2loopback
echo v4l2loopback | sudo tee -a /etc/modules
sudo modprobe bcm2835-v4l2
echo bcm2835-v4l2 | sudo tee -a /etc/modules
sudo reboot
ssh pi@ip-address
v4l2-ctl --list-devices
sudo apt install ffmpeg
ffmpeg -f v4l2 -i /dev/video1 -codec:v copy -f v4l2 /dev/video0
For older camera's you might need: ffmpeg -f v4l2 -i /dev/video1 -vf format=yuv420p -f v4l2 /dev/video0
Alsof you might need to use LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l1compat.so ffmpeg -f v4l2 -i /dev/video1 -codec:v copy -f v4l2 /dev/video0
or LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l1compat.so ffmpeg -f v4l2 -i /dev/video1 -vf format=yuv420p -f v4l2 /dev/video0
5 Install HKCam
wget https://github.com/brutella/hkcam/releases/download/v0.0.9/hkcam-v0.0.9_linux_armhf.tar.gz
tar xzf hkcam-v0.0.9_linux_armhf.tar.gz
cd hkcam-v0.0.9_linux_armhf
sudo cp usr/bin/hkcam /usr/local/bin
cd /
sudo adduser --system --ingroup video hkcam
sudo usermod -a -G video hkcam
6 Edit/add Systemd Service Configuration and Run Script
Systemd Service Configuration:
$ sudo nano /etc/systemd/system/hkcam.service
add:
# /etc/systemd/system/hkcam.service
[Unit]
Description=HKcam HomeKit Camera
After=syslog.target network-online.target
[Service]
Type=simple
User=hkcam
WorkingDirectory=/home/hkcam
ExecStart=/usr/local/bin/hkcam
Restart=always
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
followed by; ctrl-x, y, Enter
Run Script, more settings for HKCam found here:
sudo nano /etc/hkcam
add:
#!/bin/bash
# /etc/hkcam
# set the video4linux ctl parameters
v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=YU12
v4l2-ctl -c video_bitrate=1000000
# exec over to hkcam
exec /usr/local/bin/hkcam --min_video_bitrate=500 --multi_stream=true
# for old camera’s
# exec LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libv4l/v4l1compat.so /usr/local/bin/hkcam --min_video_bitrate=500
followed by ctrl-x, y, Enter
7 Activate the service
sudo systemctl daemon-reload
sudo systemctl start hkcam
sudo systemctl enable hkcam
sudo reboot
Your HKCam should now be working. Connect in the Homekit-app, following the instructions.
Debugging
If experience issues with the hkcam daemon, you can find log outputs at journalctl -xefu hkcam
Is all working with freshly released Rasbian Buster? Which is the preferred way for fresh install and which are known to work? hkcam image and apt upgrade, official Rasbian Buster and hkcam ansible or official Rasbian Buster and manual installation?