2nd webcam issues

Camera model
1st camera Logitech c920
2nd camera Logitech c922

What is the problem?
when booting up octo print before getting to the octodash screen both camera power on as indicated by the blue and white led lights on the cameras, after complete power up though only 1 or the other works and shows that is powered on. and I can only view the one that it powered on through web browser or software.

What did you already try to solve it?
inspected all the logs, change frame rate and pixel size of each, unplug and re plug into different usb ports, verify each webcam works by itself, google for answers and scoured the forums, update all the software, change port numbers (8000,8001,8002,8003), .sudo service webcamd restart.

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

pi@octopi:~ $ ls /dev/v4l/by-id
usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index0  usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index0
usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index1  usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index1

### Windows users: To edit this file use Notepad++, VSCode, Atom or SublimeText.
### Do not use Notepad or WordPad.

### MacOSX users: If you use Textedit to edit this file make sure to use
### "plain text format" and "disable smart quotes" in "Textedit > Preferences"

### 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://faq.octoprint.org/mjpg-streamer-config for available options
#
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
#
camera_usb_options="-r 1920x1080 -f 15 -d /dev/v4l/by-id/usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index0"

### Additional webcam devices known to cause problems with -f
#
# Apparently there a some devices out there that with the current
# mjpg_streamer release do not support the -f parameter (for specifying
# the capturing framerate) and will just refuse to output an image if it
# is supplied.
#
# The webcam daemon will detect those devices by their USB Vendor and Product
# ID and remove the -f parameter from the options provided to mjpg_streamer.
#
# By default, this is done for the following devices:
#   Logitech C170 (046d:082b)
#   GEMBIRD (1908:2310)
#   Genius F100 (0458:708c)
#   Cubeternet GL-UPC822 UVC WebCam (1e4e:0102)
#
# Using the following option it is possible to add additional devices. If
# your webcam happens to show above symptoms, try determining your cam's
# vendor and product id via lsusb, activating the line below by removing # and

### Windows users: To edit this file use Notepad++, VSCode, Atom or SublimeText.
### Do not use Notepad or WordPad.

### MacOSX users: If you use Textedit to edit this file make sure to use
### "plain text format" and "disable smart quotes" in "Textedit > Preferences"

### 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://faq.octoprint.org/mjpg-streamer-config for available options
#
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
#
camera_usb_options="-r 1920x1080 -f 15 -d /dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index0"

### Additional webcam devices known to cause problems with -f
#
# Apparently there a some devices out there that with the current
# mjpg_streamer release do not support the -f parameter (for specifying
# the capturing framerate) and will just refuse to output an image if it
# is supplied.
#
# The webcam daemon will detect those devices by their USB Vendor and Product
# ID and remove the -f parameter from the options provided to mjpg_streamer.
#
# By default, this is done for the following devices:
#   Logitech C170 (046d:082b)
#   GEMBIRD (1908:2310)
#   Genius F100 (0458:708c)
#   Cubeternet GL-UPC822 UVC WebCam (1e4e:0102)
#
# Using the following option it is possible to add additional devices. If
# your webcam happens to show above symptoms, try determining your cam's
# vendor and product id via lsusb, activating the line below by removing # and

pi@octopi:~ $ journalctl -u webcamd
-- Logs begin at Sun 2021-08-08 00:55:24 EDT, end at Sun 2021-08-08 02:07:34 EDT. --
Aug 08 00:55:28 octopi systemd[1]: Starting the OctoPi webcam daemon with the user specified config...
Aug 08 00:55:29 octopi systemd[1]: webcamd.service: Succeeded.
Aug 08 00:55:29 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Aug 08 00:55:30 octopi systemd[1]: webcamd.service: Service RestartSec=1s expired, scheduling restart.
Aug 08 00:55:30 octopi systemd[1]: webcamd.service: Scheduled restart job, restart counter is at 1.
Aug 08 00:55:30 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
Aug 08 00:55:30 octopi systemd[1]: Starting the OctoPi webcam daemon with the user specified config...
Aug 08 00:55:30 octopi root[613]: Starting USB webcam
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: starting application
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: Using V4L2 device.: /dev/video0
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: Desired Resolution: 1920 x 1080
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: Frames Per Second.: 15
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: Format............: JPEG
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: TV-Norm...........: DEFAULT
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: www-folder-path......: ./www-octopi/
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: HTTP TCP port........: 8080
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: HTTP Listen Address..: 127.0.0.1
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: username:password....: disabled
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: commands.............: disabled
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: starting input plugin input_uvc.so
Aug 08 00:55:30 octopi mjpg_streamer[614]: MJPG-streamer [614]: starting output plugin: output_http.so (ID: 00)
Aug 08 00:55:31 octopi root[636]: Starting USB webcam
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: starting application
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: Using V4L2 device.: /dev/video2
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: Desired Resolution: 1920 x 1080
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: Frames Per Second.: 15
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: Format............: JPEG
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: TV-Norm...........: DEFAULT
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: www-folder-path......: ./www-octopi/
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: HTTP TCP port........: 8081
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: HTTP Listen Address..: (null)
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: username:password....: disabled
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: commands.............: disabled
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: starting input plugin input_uvc.so
Aug 08 00:55:31 octopi mjpg_streamer[637]: MJPG-streamer [637]: starting output plugin: output_http.so (ID: 00)
Aug 08 00:55:32 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Aug 08 00:55:56 octopi systemd[1]: Stopping the OctoPi webcam daemon with the user specified config...
Aug 08 00:55:56 octopi systemd[1]: webcamd.service: Succeeded.
Aug 08 00:55:56 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.

Additional information about your setup (OctoPrint version, OctoPi version, ...)
OctoPrint version : 1.6.1
OctoPi version : 0.18.0

Are you using the MultiCam plugin ?

If so could you please indicate the streaming URLs that you set up in the MultiCam plugin ?

yes i am, urls i have tried are:

http:///?action=stream
/webcam2/?action=stream
/webcam/?action=stream
http://127.0.0.1:8081/

This one won't work with anything, unless there's something the forum formatting has deleted & it was supposed to have an IP address in there.

These two require that you have done the haproxy setup for the cameras, so now comes the question - have you changed the haproxy config?

This won't work with anything unless you are accessing the camera from the Raspberry Pi itself. 127.0.0.1 refers to 'this device'.

Try opening the URLs in your browser - use the full thing like http://<your-ip>:8081/?action=stream.

yes sorry that was meant to say http://:8081/?action=stream

yes I have followed your guide to change that.

global
        maxconn 4096
        user haproxy
        group haproxy
        log /dev/log local1 debug
        tune.ssl.default-dh-param 2048

defaults
        log     global
        mode    http
        compression algo gzip
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        use_backend webcam2 if { path_beg /webcam2/ }
        use_backend webcam_hls if { path_beg /hls/ }
        use_backend webcam_hls if { path_beg /jpeg/ }
        default_backend octoprint

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2

@justin1311 Are you trying to set up multicam in OctoDash ? If so, it is not supported and support is not planned.

But first things first, your haproxy.cfg file doesn't look right, especially the webcam backend. Is that all your file contains, or did ou not copy the entire contents of the file ? If you didn't please provide a full copy.

After that, we can help you set the correct stream URLs in OctoPrint.

Then back to OctoDash. In order to be able to see both of the webcams in OctoDash (according to this issue : https://github.com/UnchartedBull/OctoDash/issues/918, you need to modify OctoDash's config.json and add other custom action buttons. An alternative may be to use jneilliii's plugin OctoDashCompanion, and use it to configure the custom action button. It boasts being able to redirect the streams from the multicam plugins, as described in this and following posts from the above issue.

Please read into those and come back should you have issues setting this up.

sorry no i want multicam in octoprint. Main purpose is to use 1 camera pointed at the nozzle for monitoring and another pointed at the print for monitoring/octolapse.

that is the entire content of the file that i copied from .sudo nano /etc/haproxy/haproxy.cfg

Ah, therein lies the rub. nano is a file editor, and will only show file contents spanning your screen, you will have to scroll using keyoard keys to see the entire contents of the file.

An easier way to get the entire contents would be to copy/paste the output of sudo cat /etc/haproxy/haproxy.cfg. It may also span multiple screen sizes...

ah thought i did grab all of it at first i guess not. here is the entire content.

global
        maxconn 4096
        user haproxy
        group haproxy
        log /dev/log local1 debug
        tune.ssl.default-dh-param 2048

defaults
        log     global
        mode    http
        compression algo gzip
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15min
        timeout server  15min

frontend public
        bind :::80 v4v6
        bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        use_backend webcam2 if { path_beg /webcam2/ }
        use_backend webcam_hls if { path_beg /hls/ }
        use_backend webcam_hls if { path_beg /jpeg/ }
        default_backend octoprint

backend octoprint
        acl needs_scheme req.hdr_cnt(X-Scheme) eq 0

        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if needs_scheme { ssl_fc }
        reqadd X-Scheme:\ http if needs_scheme !{ ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend webcam
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

backend webcam_hls
        server webcam_hls_1 127.0.0.1:28126
        errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http

backend webcam2
        reqrep ^([^\ :]*)\ /webcam2/(.*)     \1\ /\2
        server webcam2  127.0.0.1:8081
        errorfile 503 /etc/haproxy/errors/503-no-webcam.http

Ok, so it looks like things are set up correctly in HAProxy.

Then on the multicam configuration screen, the URLs should look like:

  • /webcam/?action=stream
  • /webcam2/?action=stream

You could add your Pi's hostname (or octopi.local) or IP address (the URLs would then be http://octopi.local/webcam(2)/?action=stream or http://<Pi's IP address>/webcam(2)/?action=stream), but that shouldn't be necessary. You should then be able to see the webcams output.

there lies the issue I cannot. I can see one or the other but not both. so on the Logitech cams that I have there is a led light around the lenses that lights up when its powered on, currently only the c920 is powered on and showing a blue led light. last night I noticed the c922 which has a white led light was blinking but not staying on consistently, I was thinking maybe it was a power issue but I don't see anything in the logs that would indicate that. I also checked the psu for the raspberry pi since I got it from buyapi.ca and it is 5.1V 3.0A (never checked with voltage meter just read what it says.). And both camera's use at most 500ma according to the label and raspberry pi uses around 1400 ma according to google. idk about how much my prusa mks3+ uses. they used to both work fine on my old microsd card but ever since i changed it to the new one it hasn't worked properly except for that one day where you mentioned I should change it from "video1" to "video0"

When you say one or the other, you mean with only one webcam connected, am I right ?

no, while both are connected.

So you see one cam, then use the button in the interface to see the other cam in the control tab ? Or am I not understanding something here ?

may not be understanding correctly. only 1 webcam works at a time while both are plugged in. if I try to use the 2nd webcam it just keeps loading and nothing happens. I can switch between the 2 but one shows a image the other one does not. its like it only sees one plugged in and powered on/connected.

OK, yes I didn't understand what you were experiencing.

Right now I'm assuming only on camera is powered on, even though both are connected ? If so, could you please tell me if the output of ls /dev/v4l/by-id is different from the one you posted in the first post ?

that is correct.

its the same as the other post still.

usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index0  usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index0
usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index1  usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index1

That's definitely strange. Could you please copy the output of:

  • v4l2-ctl -a -d /dev/v4l/by-id/usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index0
  • v4l2-ctl -a -d /dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index0

If it complains about the v4l2-ctl command being unknown, install it using sudo apt-get install v4l-utils

pi@octopi:~ $ v4l2-ctl -a -d /dev/v4l/by-id/usb-046d_C922_Pro_Stream_Webcam_BDFE0F4F-video-index0
v4l2-ctl: invalid option -- 'a'
Unknown argument '-d'

General/Common options:
  --all              display all information available
  -C, --get-ctrl <ctrl>[,<ctrl>...]
                     get the value of the controls [VIDIOC_G_EXT_CTRLS]
  -c, --set-ctrl <ctrl>=<val>[,<ctrl>=<val>...]
                     set the value of the controls [VIDIOC_S_EXT_CTRLS]
  -D, --info         show driver info [VIDIOC_QUERYCAP]
  -d, --device <dev> use device <dev> instead of /dev/video0
                     if <dev> starts with a digit, then /dev/video<dev> is used
  -e, --out-device <dev> use device <dev> for output streams instead of the
                     default device as set with --device
                     if <dev> starts with a digit, then /dev/video<dev> is used
  -h, --help         display this help message
  --help-all         all options
  --help-io          input/output options
  --help-meta        metadata format options
  --help-misc        miscellaneous options
  --help-overlay     overlay format options
  --help-sdr         SDR format options
  --help-selection   crop/selection options
  --help-stds        standards and other video timings options
  --help-streaming   streaming options
  --help-subdev      sub-device options
  --help-tuner       tuner/modulator options
  --help-vbi         VBI format options
  --help-vidcap      video capture format options
  --help-vidout      vidout output format options
  --help-edid        edid handling options
  -k, --concise      be more concise if possible.
  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]
  -L, --list-ctrls-menus
                     display all controls and their menus [VIDIOC_QUERYMENU]
  -r, --subset <ctrl>[,<offset>,<size>]+
                     the subset of the N-dimensional array to get/set for control <ctrl>,
                     for every dimension an (<offset>, <size>) tuple is given.
  -w, --wrapper      use the libv4l2 wrapper library.
  --list-devices     list all v4l devices
  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]
  --get-priority     query the current access priority [VIDIOC_G_PRIORITY]
  --set-priority <prio>
                     set the new access priority [VIDIOC_S_PRIORITY]
                     <prio> is 1 (background), 2 (interactive) or 3 (record)
  --silent           only set the result code, do not print any messages
  --sleep <secs>     sleep <secs>, call QUERYCAP and close the file handle
  --verbose          turn on verbose ioctl status reporting

pi@octopi:~ $ v4l2-ctl -a -d /dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_A69AE6FF-video-index0
v4l2-ctl: invalid option -- 'a'
Unknown argument '-d'

General/Common options:
  --all              display all information available
  -C, --get-ctrl <ctrl>[,<ctrl>...]
                     get the value of the controls [VIDIOC_G_EXT_CTRLS]
  -c, --set-ctrl <ctrl>=<val>[,<ctrl>=<val>...]
                     set the value of the controls [VIDIOC_S_EXT_CTRLS]
  -D, --info         show driver info [VIDIOC_QUERYCAP]
  -d, --device <dev> use device <dev> instead of /dev/video0
                     if <dev> starts with a digit, then /dev/video<dev> is used
  -e, --out-device <dev> use device <dev> for output streams instead of the
                     default device as set with --device
                     if <dev> starts with a digit, then /dev/video<dev> is used
  -h, --help         display this help message
  --help-all         all options
  --help-io          input/output options
  --help-meta        metadata format options
  --help-misc        miscellaneous options
  --help-overlay     overlay format options
  --help-sdr         SDR format options
  --help-selection   crop/selection options
  --help-stds        standards and other video timings options
  --help-streaming   streaming options
  --help-subdev      sub-device options
  --help-tuner       tuner/modulator options
  --help-vbi         VBI format options
  --help-vidcap      video capture format options
  --help-vidout      vidout output format options
  --help-edid        edid handling options
  -k, --concise      be more concise if possible.
  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]
  -L, --list-ctrls-menus
                     display all controls and their menus [VIDIOC_QUERYMENU]
  -r, --subset <ctrl>[,<offset>,<size>]+
                     the subset of the N-dimensional array to get/set for control <ctrl>,
                     for every dimension an (<offset>, <size>) tuple is given.
  -w, --wrapper      use the libv4l2 wrapper library.
  --list-devices     list all v4l devices
  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]
  --get-priority     query the current access priority [VIDIOC_G_PRIORITY]
  --set-priority <prio>
                     set the new access priority [VIDIOC_S_PRIORITY]
                     <prio> is 1 (background), 2 (interactive) or 3 (record)
  --silent           only set the result code, do not print any messages
  --sleep <secs>     sleep <secs>, call QUERYCAP and close the file handle
  --verbose          turn on verbose ioctl status reporting