Help getting camera working

What is the problem?

New to using Octoprint. I have it installed in a Raspberry Pi 4b. Webcam is a Logitech c930e. I'm using the camera-streamer fork of Octopi (was hoping to use a webcam, but could never get a stable rtsp->mjpg app working).
After a fresh boot. Octoprint seems the camera and seems to be working fine, however after a few minutes, the feed stops, and it says it can't get an image from the camera anymore. I've done some limited diagnostics (I'm not an expert by any means). When the camera is working, lsusb detects it.

zxurian@octopi:~ $ lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 2109:3431 VIA Labs, Inc. Hub
        |__ Port 2: Dev 28, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
            ID 1a86:7523 QinHeng Electronics CH340 serial converter
        |__ Port 4: Dev 34, If 0, Class=Video, Driver=uvcvideo, 480M
            ID 046d:0843 Logitech, Inc. Webcam C930e
        |__ Port 4: Dev 34, If 1, Class=Video, Driver=uvcvideo, 480M
            ID 046d:0843 Logitech, Inc. Webcam C930e
        |__ Port 4: Dev 34, If 2, Class=Video, Driver=uvcvideo, 480M
            ID 046d:0843 Logitech, Inc. Webcam C930e
        |__ Port 4: Dev 34, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            ID 046d:0843 Logitech, Inc. Webcam C930e
        |__ Port 4: Dev 34, If 4, Class=Audio, Driver=snd-usb-audio, 480M
            ID 046d:0843 Logitech, Inc. Webcam C930e

and after Octoprint says it can't see the camera anymore, the webcam dissappears from lsusb

zxurian@octopi:~ $ lsusb -tv
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 2109:3431 VIA Labs, Inc. Hub
        |__ Port 2: Dev 28, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
            ID 1a86:7523 QinHeng Electronics CH340 serial converter

I don't know if this is an Octopi issue, a debian issue, or a Raspberry Pi issue. What are my next steps trying to diagnose?

What did you already try to solve it?

I already tried swapping the USB port the webcam is plugged into, no effect. Everyting is updated via apt.

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No, OctoPrint still loses access to webcam midway through.

Systeminfo Bundle

octoprint-systeminfo-20251102230910.zip (36.8 KB)

Additional information about your setup

  • Raspberry Pi 4 model b
  • OctoPrint v1.11.3
  • OctoPi Build 2025.09.30.141704 with "camera-streamer", based on OctoPi 1.1.0, running on Raspberry Pi 4 Model B Rev 1.2
  • Snapmaker 2 A350
  • Using both chrome/firefox to visit OctoPrint page.

I had the same issue though I was running two Logitech cameras and one borescope camera at the time.

To solve it I did the following.

Attached all USB devices EXCEPT the printer to an external USB powered hub.
Lowered the resolution and frame rate of the Logitech cameras.

I found that the USB hub alone did not solve the issue and traced the loss of the USB connection down to the Pi's USB stream being overwhelmed with both the camera streams and the Network connections.

The combination of the two actions however resolved everything.

thanks for the tip. How did you end up changing resolution & framerate for the connected camera?

I ssh'd into the PI and edited the /boot/camera-streamer/*.conf files.

Since I have three cameras I edited three files.

I set the resolution to 800x448 and 10 FPS to get stability on all three cameras.

With one I could go higher with the same FPS.

While looking at my files I just noticed a VERY important change I made that may cure your issue without doing anything else.

Look for this line and increase the buffers as I have below...

#Number of buffers to use. Defaults to 2
NBUFS=16

Give that a shot.