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

How can I use camera-streamer in multiple instances? I have a 5001 and 5002 instance with both usb and raspicams. I tried using add-usb-camera and specifying those ports as well as trying to edit both configs in the camera-streamer folder.

Here's my log : WacBl-gITvg - paste.octoprint.org

Thank you so much! I'll try it out this afternoon.

How did you fix the driver error? I‘ve installed the arducam stuff, changed the config.txt and recompiled the streamer and it still doesn‘t work.

When I try the test command to take a photo, it throws 2 errors: Camera no found and driver needs an upgrade.

Do you know how I could fix that?

@flipside
Can you help me with this?

its gone down for me . i have teh camera installed and reporting in but for the life of me i cant get octopi to recognise it. Does anyone ahve any suggestions ?

Command line output
libcamera-hello
Preview window unavailable
[0:02:43.520725994] [1522] INFO Camera camera_manager.cpp:299 libcamera v0.0.0+ 4225-74d023d8
[0:02:43.583033627] [1524] INFO RPI raspberrypi.cpp:1476 Registered camera /bas e/soc/i2c0mux/i2c@1/imx519@1a to Unicam device /dev/media1 and ISP device /dev/m edia0
[0:02:43.584004987] [1522] INFO Camera camera.cpp:1028 configuring streams: (0) 2328x1748-YUV420
[0:02:43.584431077] [1524] INFO RPI raspberrypi.cpp:851 Sensor: /base/soc/i2c0m ux/i2c@1/imx519@1a - Selected sensor format: 2328x1748-SRGGB10_1X10 - Selected u nicam format: 2328x1748-pRAA
#0 (0.00 fps) exp 32844.00 ag 8.00 dg 1.00
#1 (30.00 fps) exp 32844.00 ag 8.00 dg 1.00
#2 (30.00 fps) exp 32844.00 ag 8.00 dg 1.00

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.