Setting up multiple webcams in OctoPi the right way

I'm not getting any output from my Raspberry Cam only from USB.

I have an IMX219, so I added the following to config.txt


dtoverlay=imx219

and changed camera_auto_detect=1 to

camera_auto_detect=0

as for octopi.txt

camera="usb"
camera_usb_options="-r 640x480 -f 10"

Ah, yes. Sorry I forgot I had used that before working on this. Thank you.

Tried to set up my usb cam but this guide does not work with octopi 1.0 as it looks like. Cam ID command does not work anymore and not able to setup my USB cam. Any information when you will rework this guide for 1.0?

Not sure what you mean by this - it should work fine on OctoPi 1.0.0. The camera="raspi" mode no longer exists, but otherwise it works the same. Can you provide some more details of what is not working? What output do you get when trying to set it up?

ls /dev/v4l/by-id when running this I get the message no such file or directory

That indicates that your camera is not recognised by the system. When there are no cameras to be found, you get 'no such file or directory'. Upon plugging in the camera, it is created. I would probably recommend opening your own topic to debug why your camera is not recognised, but have a look at commands such as lsusb and dmesg to help.

Hi,

I'm having the problem with multiple cam. One is a normal webcam and another is endoscope.

Haven't had luck for them to work at the same time. After every boot it seems random which camera works. And if I reboot without making any configuration change, then it might be the another camera that works.
I have the MultiCam plugin added and I can switch between cameras with the buttons (but just that only one works at the time).

What could cause this kind of behaviour and is there something that could be changed in config for both of them to work?

I have not done the Haproxy configuration part.

Good day Charlie
I am apealing to you as the "go to guy" for all things webcam related on the Raspberry Pi 4+ / Octopi :grin:
After running Octopi for a couple of years using a script provided by Chris Riley who managed to get my Pi cam, Logitech 270 & Logitech C920 running via multi-cam in octoprint. I ran across a problem where after a new SD card was needed i found i could no longer use the same script. Now i have tried following Chris's updated youtube instructions but some of the part he refers to no longer seem to be present in the "Octopi.Txt" file, such as "default camera" and i also see a comment saying RaspiCam is no longer in theOctopi.Txt file but is reffered to in something called the UVC folder!!!!
Being a complete novice to the Octopi language i am at a complete loss.
This is where i come cap in hand to your good self for pointers and directions to get my setup running again! Does the thing about RaspiCam & UVC get dealt with in [latest camera-streamer based webcam stack build (20230328122604) ??? Or am i barking up the wrong tree??
Please, any pointers would be greatly appreciated, and appologies if i have contacted you in the wrong way! Thanks

Open a new topic if your questions are not related to this guide

Done that Charlie

What i have done to "fix" this is i added a restart of the service after boot inside the crontab.

sudo crontab -e

in the crontab file at the end of the file add the following.

@reboot sleep 30 && sudo service webcamd restart

The command will be executed after every boot with a delay of 30 seconds.

you could probably also use event manager in OctoPrint to do the same command on server startup.

It seems that I removed everything according to the instructions.
But the second camera did not start.

sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2023-05-07 01:16:44 MSK; 1s ago
  Process: 2136 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
    Tasks: 6 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           β”œβ”€2179 ./mjpg_streamer -o output_http.so -w ./www -n -p 8082  -i input_uvc.so -r 1280x720 -d /dev/video0
           └─2197 ./mjpg_streamer -o output_http.so -w ./www -n --listen 127.0.0.1 -i input_uvc.so -r 1280x720 -f 10 -d /dev/video2

May 07 01:16:43 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: Format............: JPEG
May 07 01:16:43 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: TV-Norm...........: DEFAULT
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: www-folder-path......: ./www/
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: HTTP TCP port........: 8080
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: HTTP Listen Address..: 127.0.0.1
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: username:password....: disabled
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: commands.............: disabled
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: starting input plugin input_uvc.so
May 07 01:16:44 octopi mjpg_streamer[2197]: MJPG-streamer [2197]: starting output plugin: output_http.so (ID: 00)
May 07 01:16:44 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.

hi ive tried and its not working when i test. http://192.168.0.107:8082

for some reason i dont seem to have a /var/webcamd.log so cannot look in there, i would realy apreciate some help.
thanks
martin
my webcam2 file

### Configure which camera to use
#
# Available options are:
# - auto: tries first usb webcam, if that's not available tries raspi cam
# - usb: only tries usb webcam
# - raspi: only tries raspi cam
#
# Defaults to auto
#
camera="usb"

### Additional options to supply to MJPG Streamer for the USB camera
#
# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration
# for available options
#
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
#
camera_usb_options="-r 1080x720 -f 10 -d /dev/v4l/by-id/usb-Huawei_HiCamera_12345678-video-index0"



### additional options to supply to MJPG Streamer for the RasPi Cam
#
# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration
# for available options
#
# Defaults to 10fps
#
#camera_raspi_options="-fps 10"

### Configuration of camera HTTP output
#
# Usually you should NOT need to change this at all! Only touch if you
# know what you are doing and what the parameters mean.
#
# Below settings are used in the mjpg-streamer call like this:
#
#   -o "output_http.so -w $camera_http_webroot $camera_http_options"
#
# Current working directory is the mjpg-streamer base directory.
#
camera_http_webroot="./http://192.168.0.107"
camera_http_options="-n -p 8082"

# Configuration of network monitoring
#
# This enables network monitoring for wifi connections with a simple ping test.
# If connection terminates by variable reasons system tries to restart the wifi connection to reestablish a connection.
# The connection test is done every minute.
# By default it is disabled (0 = off / 1 = on)
# destination_host can be an ip address or a hostname (for hostname ensure dns resosultion is working correctly)
#enable_network_monitor=0
#destination_host=192.168.1.1

### EXPERIMENTAL
# Support for different streamer types.
#
# Available options:
#   mjpeg [default] - stable MJPG-streamer
#   hls - experimental FFMPEG HLS streamer
#camera_streamer=mjpeg

An update to this guide would be so helpful!

I can no longer have 2 cameras.

I see my USB Camera but I cannot use my raspicam anymore when I try to use multiple cameras since the camera="raspi" has been removed and I don't know which device I have to add to the "camera_usb_options=" via parameter "-d" because this is simply not in the not updated yet guide.
I tried to use the -d dev/v4l/by-path/platform-bcm2835-isp-video-index0 but it doesnt work.

So long I have to go with 1 camera but 2 cameras are so convinient and maybe there could also be a UI within OctoPrint for this instead of having to fiddle around with the files (just a wish for the future).

Thank you for all the great work so far. Enriches my 3D printing life so much!

With the advent of the new camera stack for OctoPi it's not top of my priorities to get out my RPi cam & the old stack now to figure out what it should be. If it's simple and takes me 5 mins (or if someone else knows the answer) that would be good. I can't do it at the moment as I don't have the hardware accessible.

I can definitely recommend the new camera stack, which also makes adding new cameras even easier - it's available in the RPi imager as an additional option.

Has this plugin died :man_shrugging:

Not that I'm aware of. You have to manually install since it's unlisted. Go to plugin manager > get more and at the bottom in the ...from URL field copy/paste this url and click install.

https://github.com/jneilliii/OctoPrint-MultiCamView/archive/refs/heads/master.zip
1 Like

I did as resort from a backup and the plugin didn't reconfigure, try to install it manually, but that also failed.

Forgot about

Cheers works perfectly again :+1:

Is there an updated version for the new stack yet?

It's documented in the FAQ at the bottom.