Discussing the new camera-streamer based webcam stack for OctoPi currently in development

OK so this worked for me -NOTE IM TESTING FURTHER AS IT SEEMS NOT NEEDED IF YOU DISABLE AF -

i followed steps 1,2 and 4 here - Quick Start - Arducam Wiki

Then compile and reinstall camera streamer from here GitHub - ayufan/camera-streamer: High-performance low-latency camera streamer for Raspberry PI's

Setup a symbolic link from /usr/bin/ to the new camera streamer in /usr/local/bin

in the command line cd to /usr/bin and run the command 'ln -s /usr/local/bin/camera-streamer'

ok so currently the arducam scripts remove camera-streamer

After some further testing it looks like if you don't want to use the autofocus ability of the Arducam 16mp AF camera then this works OOTB. You just need to remember to add in the config.txt entries and hash out the AF setting in the camera streamer conf file.

To use AF then my option above works until the arducam libcamera PDAF/CDAF changes are reflected upstream to the PI libcamera implementation

Thank you so much for sharing your research!
So wait, you are saying the camera works out of the box without AF?! What version of OctoPi do I need to be running? Do I need octopi-uptodate? And what do I need to add/comment out of the config.txt?

How do I create a symbolic link?

Is it enough to just run:

Step 1:
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh

Step 2:
./install_pivariety_pkgs.sh -p libcamera

Step 3 gets left out

Step 4:
For IMX519 Autofocus Camera Modules:

sudo nano /boot/config.txt 
add dtoverlay=imx519 under the line [all]
#Save and reboot.

For IMX519 Fixed Focus Camera Modules:

sudo nano /boot/config.txt 
add dtoverlay=imx519,vcm=off under the line [all]
#Save and reboot.

Which Step 4 do I need to use? Fixed focus or Autofocus?

Also how do I access the stream?

ok so if you want it without AF just flash teh latest build from octopi build and then add
/boot/config.txt

# Example for IMX519
dtoverlay=vc4-kms-v3d,cma-128
gpu_mem=128 # preferred 160 or 256MB
dtoverlay=imx519

and in /boot/camera-streamer/libcamera.conf

hash out the last line that mentions AfMode=2" --camera-options="AfRange=2

finish setting up octopi and it shoudl all be there - i then added camera setting addon to control the maual focus

Thank you so much! I‘ll try this today!
Do I need to change anything about the camera-stream link in octoprint?

@flipside
Update: I tried it out and the stream was there. But for some reason it was black.

I for some reason decided to try it with a newer version. After downloading I noticed, that there was no camera-streamer folder in there. Now I'm trying with the build from March 28th. What version are you using?

Do you have any idea why it could have been black?

I'll come back tomorrow. I'd be really happy, if you could help me. :grin:

I got it to work yesterday. :partying_face: :partying_face: Here are my steps for everyone who needs it:

To make it work I did these two steps described by @flipside
At first SSH into the Pi. If you don't know how, look it up on the internet.

In the root directory of the Pi type:
cd /boot
sudo nano config.txt

Then put the following unter the header "[all]":


dtoverlay=vc4-kms-v3d,cma-128
gpu_mem=128 # preferred 160 or 256MB
dtoverlay=imx519


Write out the file by pressing "Ctrl+O" and then "Enter". You can exit the file with "Ctrl+X".

Next, open the "libcamera.conf" file by pasting the following commands into the terminal:
cd camera-streamer
sudo nano libcamera.conf

Put a "#" in front of the following:


OPTIONS='--camera-options="AfMode=2" --camera-options="AfRange=2"'


Putting a "#" in front of something, makes it a comment. Comments don't get read by the system.
Write out the file by pressing "Ctrl+O" and then "Enter". Exit the file with "Ctrl+X".

In your camera settings in Octoprint you should have:


/webcam/?action=stream


Everything should be working and you should be up and running.

I've got my imx519 camera working following the instructions here, and commented out the OPTIONS line in the libcamera.conf. However, my camera is out of focus (yes it is autofocus). How can I get the camera focused?

Hi! I‘m glad that you got it to work! There is a plugin on Octoprint called „Camera Settings“ (I think).

Install the plugin, go to the plugin tab, adjust the focus and save it as a profile. Make sure to enable „load profile on startup“.

Everything should work now.

Feel free to write me if you have got any further issues. :grin::grin:

I tried two different plugins, the one called "Camera Settings", and another "ArduCamFocus". Camera Settings did not give me the option to focus my camera. I went through the possible setup options on the setup page, but still did not see any option for Focus.

The ArduCamFocus plugin did have a focus feature, but it was disabled (red circle/slash symbol, so would not let me focus. It hasn't been maintained for a few years, so likely not updated to work with the latest stuff.

I've got a new camera coming that is not autofocus, so hoping that gets me to where I want to be.

The ArduCamFocus Plugin did not work for me.

On the Camera Settings Plugin you see a camera stream and right under there there is a slider. It is not labelled as focus, but it changes the focus. Just try it out. :slight_smile:

This plugin technically only works with motorized manual focus arducam cameras. I had it working at one point but think something probably changed in Bullseye that broke the plugin.

I just installed camera-streamer on a new Bookworm PI4 to have a my new printer with latest stuff. The cam is a PI Camera Module v3. I compiled and installed it because I followed the wiki guide and missed the .deb releases.
For the moment it runs well. I still didn't play with parameters, it is too new.

I just wonder why camera-streamer was chosen over ustreamer for OctoPI?

One of the big benefits of camera-streamer over ustreamer is the webrtc protocol. It's much less bandwidth intense as mjpeg streams on the network and as such should perform better overall.

1 Like

OK. I just tried it as I saw a reference in IP/webcam/ and IP/webcam/control. I will then configure my Octoprints to use webrtc.
I didn't know ustreamer didn't have that feature.

For the moment I stick to mjpeg as I didn't find a way to make /webcam/webrtc working in Octoprint. Seems related to Iframe not supported.
My config: PI4 / Bookworm / CMv3 / camera-streamer (compiled > 2023/10/14) / Octoprint 1.9.3

You would have to install this plugin to use it - it's WIP still, I don't have time right now to polish it up & publish it, but it works.

2 Likes