ayufan / camera-streamer

High-performance low-latency camera streamer for Raspberry PI's
321 stars 47 forks source link

Arducam IMX219 8MP Setup #155

Open git2212 opened 1 week ago

git2212 commented 1 week ago

Hello,

I am trying to add ARDUCAM (IMX219) support to my Klipper setup on an OrangepiZero 3 running an Octoprint frontend. Since the recommended OS was an Armbian Bookworm image, that's what I installed... as a result most of the "guides" out there targeted at PI seem to not apply.

I want to use Octoprint's support for camera-streamer with camera support via libcamera so I went ahead and installed the available APT packages

libcamera0.3 libcamera-tools libcamera-v4l2.

As per the camera-streamer github, I used the following to install:

PACKAGE=camera-streamer-$(test -e /etc/default/raspberrypi-kernel && echo raspi || echo generic)_0.2.8.$(. /etc/os-release; echo $VERSION_CODENAME)_$(dpkg --print-architecture).deb
wget "https://github.com/ayufan/camera-streamer/releases/download/v0.2.8/$PACKAGE"
sudo apt install "$PWD/$PACKAGE"

Everything appears to have installed without errors.

I am now stuck at configuring a proper camera-streamer service... I attempted to use the following:

[Unit]
Description=camera-streamer web camera for USB camera on Generic platform
After=network.target
ConditionPathExistsGlob=/dev/v4l/by-id/usb-*-video-index0

[Service]
ExecStart=/usr/bin/camera-streamer \
  -camera-path=/dev/video1 \
  -camera-format=JPEG \
#  -camera-format=MJPG \
  -camera-width=1920 -camera-height=1080 \
  -camera-fps=30 \
  ; use two memory buffers to optimise usage
  -camera-nbufs=3 \
  --http-listen=0.0.0.0 \
  --http-port=8080 \
  ; disable video streaming (WebRTC, RTSP, H264)
  ; on non-supported platforms
  -camera-video.disabled

DynamicUser=yes
#User=pi
#Group=pi
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M

[Install]
WantedBy=multi-user.target

but it fails to run and aborts with

Main PID: 8910 (code=exited, status=216/GROUP)

From what I can tell, it is complaining about setting the 'group' ... but why? I've tried it running as

User=pi
Group=pi

but same no joy.

For what it's worth, v4l2-ctl --list-devices spits out the camera as:

cedrus (platform:cedrus):
    /dev/video0
    /dev/media0

Arducam_8mp: USB Camera (usb-5311000.usb-1):
    /dev/video1
    /dev/video2
    /dev/media1

libcamera appears to work as it's cam -l utility lists the camera as:


Available cameras:
1: 'Arducam_8mp: USB Camera' (/base/soc/usb@5311000-1:1.0-0c45:6366)

Not sure if I am missing a permission somewhere or my service config is just wrong... any suggestions would be greatly appreciated :)

git2212 commented 1 week ago

I was able to run camera-streamer as a service once I removed i2c from supplimentary groups... I don't actually have an i2c group... it still begs the question, why would it not work with pi:pi ?... that user:group is valid...