I've updated the script to include all above tweaks (resolution and autofocus) and added prompt for reboot at the end. I have also moved the location, but am leaving the original in place for a while as well (I plan to update it to just wget the new location or echo a moved notice.) a copy in the original location with a moved notice and offer to download from the new location when executed.
Like the previous version, I initially tested with a 64bit nightly, but am now running the 32bit RC3 build and tested using @gambiting's instructions updated with the new cam3install url.
This method is confirmed to work on 3A+, 3B and 4 models.
Attempts to use this method on a Zero 2W have not been successful.
Download the Octoprint RC3 release image here:
https://unofficialpi.org/Distros/OctoPi/nightly/2022-10-27_2022-09-22-octopi-bullseye-armhf-lite-1.0.0.zip
Flash it to a microsd card, boot up the raspberry pi as usual, don't do anything else on it yet.
Log in, either locally or via SSH, doesn't matter.
Then run the following:
wget https://raw.githubusercontent.com/ltlowe/misc/main/picam3/cam3install.sh
chmod +x cam3install.sh
./cam3install.sh
restart your system.
After the reboot the camera should be working with default Webcam & Timelapse
settings, although you may want to change the aspect ratio to 16:9 since the camera module 3 is a wide aspect ratio camera.
Resolution
I tried various settings for setting the camera resolution. The script sets them to the highest I was able to validate, although not the highest supported by the camera. This script sets the stream and snapshot resolutions to
- Stream (default): 1920x1080
- Snapshot (default): 1920x1056
- Stream (low): 960x512
- Snapshot (low): 960x512
Stream Lag
By default, Octoprint uses the high resolution stream and snapshot. If live view on the control tab is slow or lagging, try setting the Stream URL to /webcam/?action=stream&res=low
on the Webcam and Timelapse
page. The lowres stream is 960x512
and is the one I personally use.
Autofocus
This script automatically enables autofocus for the full range. If you prefer manual focus via the Camera Settings
plugin or other method, you can modify the camera-streamer service file.
Edit /home/pi/camera-streamer/service/camera-streamer-pi708-12MP.service
and remove the following lines, followed by another reboot (or restart the service.)
; Enable Continuous Autofocus
-camera-options=AfMode=2 \
-camera-options=AfRange=2 \