Issues with adding USB cameras to PiCam. * UPDATED *

Camera model
Raspberry Pi Cam straight to board, Logitech C270 and Logitech C920
What is the problem?
I am trying to add the two Logitech USB cameras to Octoprint but the procedures I have been following ( Chris Riley of "Chris's Basement" on YouTube don't match the text in the Octopi.Txt file.
Specifically I can see no "Default Camera" listed and also noticed that the Raspberry Pi Cam has been dealt with by UVC??

What did you already try to solve it?
I have located the USB cameras by using "lsusb" and they are showing up.
I have confirmed that both cameras are working on laptop.
I have tried creating "Octopi.conf.d" and making copies of Octopi.Txt into webcam2 & 3 and all the associated entries.
I have edited the octopi.txt file to contain camera=usb.
All the port entries were altered in the webcam2 & 3 files to 8081 and 8082
I have installed multi-cam in octoprint and added the 2 usb cameras and the settings including their respective ports and paths.
I note some comments about a procedure to use in the webcam forum but I cannot seem to find the procedure hence resorting to Youtube!!!

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support) (23.3 KB)

Additional information about your setup (OctoPrint version, OctoPi version, ...)
Octoprint 1.8.7
Python 9.3.2
Octopi 1.0.0

I would recommend following the original guide on how to setup multiple webcams, linked below:

You should reference the cameras directly in each config, using the /dev/v4l2/by-id/.... form to ensure that the cameras don't change which configuration they follow.

Your configuration doesn't seem to be set correctly, because there are no different port numbers etc. being seen by the webcam stack. They all look to be the default settings still:

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen

Explicitly set USB device:

cfg_file:      /boot/octopi.conf.d/webcam2.txt
camera:        auto
usb options:   -r 640x480 -f 10 -d
raspi options: -fps 10
http options:  -w ./www-octopi -n

Explicitly set USB device:
/boot/octopi.conf.d/webcam3.txt: line 59: unexpected EOF while looking for matching `"'
/boot/octopi.conf.d/webcam3.txt: line 78: syntax error: unexpected end of file
cfg_file:      /boot/octopi.conf.d/webcam3.txt
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen

Explicitly set USB device:

cfg_file:      /boot/octopi.conf.d/webcam4.txt
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen

Explicitly set USB device:

Did you uncomment the configuration lines correctly? Perhaps sharing the files would be good so we can try and spot errors.

Additionally, there is an error about a missing " somewhere in webcam3.txt.

Thanks Charlie, I will be working with a fresh install later today, I will follow the guide and report back. Thanks.

Hi Charlie
I have carried out the fresh install on the Pi and have started Octoprint on the PC to confirm it is working. I can also confirm the feed from the Raspi cam is being displayed in the control section of the UI.
Started following the procedure you pointed to and have done the following:
RUN and logged in to octopi via SSH using Putty
RUN cd /boot
RUN sudo mkdir octopi.conf.d
RUN sudo cp octopi.txt octopi.conf.d/webcam2.txt
RUN ls /root/dev/v4l/by-id

Once I plug the usb camera in the stream from the Raspi stoped working so I have redone the fresh install as per above but with the Pi Cam unplugged, the USB camera plugged in and the Octopi.Txt file adjusted with the following options:


camera_usb_options="-r 640x480 -f 10 -dev /dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_EA8C33AF-video-index0"

camera_http_options="-n -p 8081"

this brings the stream from the C920 up in the octoprint UI Control section.

To get the 2nd USB camera to work i plugged it in and entered the following:
kdhdd@octopi:/boot $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:082d Logitech, Inc. HD Pro Webcam C920
Bus 001 Device 003: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
which shows it is now seeing the C270 & C290.

followed by:
kdhdd@octopi:/ $ ls /dev/v4l/by-id
which gives:

Why does it not show the long id for the C270?? Have i done something wrong or missed out something? Do i have to create a webcam3.txt file first??


This means that your USB camera is not detected by your Pi. It only works if there is a camera to list. Make sure you are typing a lower case L not a 1 (l not 1), that catches people out sometimes.

You need the long name to put in the configuration file. It doesn't matter how you do this, whether it is copying & pasting somewhere or writing it down or memorising everything yourself. There's no specific step here.

But, when i did the ls /dev/v4l/by-id it gave the following:
kdhdd@octopi:/ $ ls /dev/v4l/by-id
which is not showing the long name for the C270!!!! Have i missed something, ie should i have created a webcam3.txt file??
Cheers Kev

you may be pulling too much current from the USB ports and its not fully powering the camera, or causing issues with the pi seeing it properly. I would suggest trying them one at a time. If it sees them that way, then get a powered USB hub. Also, plugging them in while the pi is running, due to the initial surge of power they use, can cause the pi to crash

1 Like

The first two devices here reference your C270, but it is not explicitly named that, only using it's ID - you'll notice the ID from your lsusb command matches up with what the camera has been 'named'. The second two are the C920. Use the ones ending in video0.

Brilliant, thanks a lot Charlie I never spotted the difference in those lines.
So would I use the "usb-046d_0825_BE64540-video-index0" in place of where I put the long address in "octopi.conf.d/webcam2.txt" and save it as "webcam3.txt" ??

I don't know what you put in /webcam2.txt so I can't answer that question. If you follow where the guide says to put it then you should get to the right place.

I tried following the guide but unless i am reading it incorrectly it says to make a copy of the octopi.txt and call it webcam 2 and put it in the octopi.conf.d directory.
However it does not mention about port number in the first or the long "usb-046d_HD_Pro_Webcam_C920_EA8C33AF-video-index0" number. Do i just ignore this for the C920 camera and just put port 8081 and the http reffernce in the webcam2.tx file??
This is where i am getting confused! thanks

Yes it does not, because this stays as the default for the first one.

It does mention that you must edit /boot/octopi.txt for your first webcam, as well as then creating the second one (and however many more you want to add after that). Step 3 of the second section:

OK this is what is confusing me.
Are you saying that the octopi.txt file just has the camera="usb" added
This file is then copied to the webcam2.txt and the webcam3.txt is actually for the 2nd usb camera ? If this is the case then i think i get it! if not then i am fudged!!!! :grin: Cheers

No, you need to follow the guide precisely.

Section 1 of the guide has you copy /boot/octopi.txt to /boot/octopi.conf.d/webcam2.txt in preparation.

Section 2 of the guide has you edit /boot/octopi.txt to configure both the camera= line and the camera_usb_options= parts. This is for your 'first' camera you would like to use.

Section 3 of the guide has you edit /boot/octopi.conf.d/webcam2.txt, the second configuration file, setting the camera=, camera_usb_options= and camera_http_options= to setup your second camera.

I notice that you want to add three cameras to the setup. Walk before you run, get two setup & fully working first, then come around and repeat the steps (ignoring step 2 since octopi.txt is already setup) to setup a third file.

Hi Charlie
Well i have finally managed to get both streams displaying via multi-cam ( don't as how i solved it but i am prettty tired LoL ), but i am now having problems with the Snapshot.
In the Webcam & Timelapse part of settings i have the following in the Snapshot URL box:
But when i run the test i get " Could not retrieve snapshot URL, please double check the URL"
What do i need to put in the Snapshot Box and do i need to add anything to the multi-cam settings to reflect this?

Thanks for all the help.

** UPDATED **. Now solved, thanks to all