Git Product home page Git Product logo

Comments (6)

PvdGulik avatar PvdGulik commented on May 17, 2024 2

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:

  • Flash SD card with image Raspberry Buster Lite using Raspberry Pi Imager app or equivalent.
  • add the files ssh & wpa_supplicant.conf (with your Wifi-settings) in the root of the card
  • Put SD in Raspberry-Pi Zero W, and powerup your Raspberry Pi
  • find ip-address and connect with ssh pi@ip-address
  • The password is: raspberry

2 Change basic settings:

  • sudo raspi-config
  • Change password, hostname, GPU —>128 Mb, Timezone, Wifi regional settings, expand file-system), enable Camera when using Raspberry Pi camera module, for usb-camera leave off. reboot
  • connect with ssh pi@ip-address
  • the password is now your created password
  • 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:

  • connect with ssh pi@ip-address
  • the password is again your created password
  • test for Raspberry Pi camera module:
  • raspistill -o test.jpg
  • test for usb-camera:
  • 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
  • connect with ssh pi@ip-address
  • the password is again your created password
  • Check if v4l2loopback is correct installed by:
  • v4l2-ctl --list-devices
  • If all correct you'll find detailed info about your camera-device /dev/video1, and the virtual video device /dev/video0.
  • sudo apt install ffmpeg
  • Check if ffmpeg is working with:
  • 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

from hkcam.

brutella avatar brutella commented on May 17, 2024

I haven't tested it on Buster yet.

from hkcam.

robacarp avatar robacarp commented on May 17, 2024

@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.

from hkcam.

JekleFPV avatar JekleFPV commented on May 17, 2024

@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?

from hkcam.

rcarmo avatar rcarmo commented on May 17, 2024

See #90 for the changes I did.

from hkcam.

brutella avatar brutella commented on May 17, 2024

hkcam supports Buster and Raspberry Pi OS since version 0.1.0.

from hkcam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.