Skip to content

Commit 7ffb82d

Browse files
committed
WIP: libcamera support in webcamd
1 parent 89797e2 commit 7ffb82d

5 files changed

Lines changed: 393 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ A bunch of simple update scripts are run via [CustoPiZer](https://github.com/Oct
1111

1212
* `01-update-octoprint`: Updates OctoPrint to the latest version
1313
* `02-update-boot`: Updates bootloader and kernel to the latest version
14-
* `10-install-arducam-mjpg-streamer`: Replaces the existing mjpg-streamer with the Arducam fork available [here](https://github.com/ArduCAM/mjpg-streamer).
14+
* `10-install-arducam-mjpg-streamer`: Replaces the existing mjpg-streamer with the Arducam fork available [here](https://github.com/ArduCAM/mjpg-streamer)
15+
* `11-install-libcamera-webcamd`: Replaces the existing webcamd script with one capable of using the new libcamera stack for RPi
1516
* `80-install-user-fix`: Installs a compatibility layer to support renaming the `pi` user, if needed.
16-
* `81-fix-octopi-txt`: Replaces `/boot/octopi.txt` with one with updated documentation regarding camera options.
1717
* `99-write-build`: Writes the build tag to `/etc/octopiuptodate-build`
1818

1919
## How do I run this?
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
set -x
2+
set -e
3+
4+
export LC_ALL=C
5+
6+
source /common.sh
7+
install_cleanup_trap
8+
9+
# already done, so we don't need to do anything
10+
grep -q "camera_libcamera_options" /boot/octopi.txt && exit 0
11+
12+
# new octopi.txt
13+
cp /files/octopi.txt /boot/octopi.txt
14+
15+
# new webcamd
16+
cp /files/webcamd /root/bin/webcamd
17+
chmod +x /root/bin/webcamd
18+
19+
# enable camera auto detect and slightly increase gpu mem
20+
sed -i 's/^camera_auto_detect=0/camera_auto_detect=1/' /boot/config.txt
21+
sed -i 's/^gpu_mem=128/gpu_mem=200/' /boot/config.txt
22+
23+
# update error page
24+
if grep -q "camera_usb_options" /etc/haproxy/errors/503-no-webcam.http; then
25+
sed -i 's/camera_usb_options/camera_uvc_options/g' /etc/haproxy/errors/503-no-webcam.http
26+
fi

scripts/81-fix-octopi-txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

scripts/files/octopi.txt

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,36 @@
44
### MacOSX users: If you use Textedit to edit this file make sure to use
55
### "plain text format" and "disable smart quotes" in "Textedit > Preferences"
66

7-
### Heads-up: The "input_raspicam" input module of mjpg-streamer is no longer supported.
8-
### Raspicam support is now available on the "input_uvc" module.
7+
### Heads-up: As of OctoPi 1.0.0, the raspi input option has been removed. Instead
8+
### there's now the libcamera input option. Additionally, USB webcams are now
9+
### configured through camera_uvc_options instead of camera_usb_options.
910

10-
### Additional options to supply to MJPG Streamer for the USB camera
11+
### Configure which camera to use
12+
#
13+
# Available options are:
14+
# - auto: tries libcamera if detected, otherwise tries first uvc if available
15+
# - uvc: only tries uvc
16+
# - libcamera: only tries libcamera
17+
#
18+
# Defaults to auto
19+
#
20+
#camera="auto"
21+
22+
### Additional options to supply to MJPG Streamer for libcamera devices
23+
#
24+
# See https://faq.octoprint.org/mjpg-streamer-config for available options
25+
#
26+
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
27+
#
28+
#camera_libcamera_options="-r 640x480 -f 10"
29+
30+
### Additional options to supply to MJPG Streamer for uvc devices
1131
#
1232
# See https://faq.octoprint.org/mjpg-streamer-config for available options
1333
#
1434
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
1535
#
16-
#camera_usb_options="-r 640x480 -f 10"
36+
#camera_uvc_options="-r 640x480 -f 10"
1737

1838
### Additional webcam devices known to cause problems with -f
1939
#

0 commit comments

Comments
 (0)