Webcam stopped working after 30 mins

I have two web cams, when I first connected one, it worked for about 30 minutes. I could not get it to work again. I tried the second camera, again it worked for about 30 minutes. Now I cannot get either one to work with the Pi. They do work when connected to my desktop. I have attached my system info bundle. Please advise.
octoprint-systeminfo-20220720013039.zip (611.9 KB)

You asked your question in a FAQ post, which is for general questions, not specific problems - so I moved it to a fresh thread :slight_smile:

Have you tried it without any other USB device connected (including the printer)?

I have taped the +5v connection on the Printer USB cable. Still no camera

I'm just another user, but I have a fair bit of linux experience. I notice in the webcamd.log file, that you have about 12 video devices listed, but it's using the first one (/dev/video0), and I suspect that the webcam is another device. Have you tried switching devices?

Well... after investigating it looks my octopi instance also has multiple video devices:
pi@octopi-mini:~/.octoprint/logs $ ls -l /dev/video*
crw-rw---- 1 root video 81, 0 Jul 14 11:37 /dev/video0
crw-rw---- 1 root video 81, 1 Jul 14 11:37 /dev/video1
crw-rw---- 1 root video 81, 6 Jul 14 11:37 /dev/video10
crw-rw---- 1 root video 81, 7 Jul 14 11:37 /dev/video11
crw-rw---- 1 root video 81, 8 Jul 14 11:37 /dev/video12
crw-rw---- 1 root video 81, 2 Jul 14 11:37 /dev/video13
crw-rw---- 1 root video 81, 3 Jul 14 11:37 /dev/video14
crw-rw---- 1 root video 81, 4 Jul 14 11:37 /dev/video15
crw-rw---- 1 root video 81, 5 Jul 14 11:37 /dev/video16
crw-rw---- 1 root video 81, 9 Jul 14 11:37 /dev/video18

Can you log into the Pi running octoprint?

You might check that the pi user is in the video group:
pi@octopi-mini:~/.octoprint/logs $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),5(tty),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),997(gpio),998(i2c),999(spi)

The actual 'usable' camera is probably on video0/video1, sometimes the number increases if you unplug the camera and plug it in, depending on how the OS is allocating it.

Some of the other devices are hardware encoders on the Pi. I can't tell you exactly, but v4l2-ctl --list-devices gives them names.

pneumaticdeath, thank you for your help. I only have two cameras so these are duplicates. Everytime I unplug it, I have to plug it in then reboot my pi to get the camera to work again. I am new to linux so I'm uncertain about a lot of things... do I need to type this in after I log in?: pi@octopi-mini:~/.octoprint/logs $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),5(tty),20(dialout),24(cdrom),27(sudo),29(audio), 44(video) ,46(plugdev),60(games),100(users),105(input),109(netdev),997(gpio),998(i2c),999(spi)

If you aren't sure how to log into your pi, here's a brief rundown:
First you need to connect from your current computer. If this is a mac (or a linux box) then you can open a terminal and type ssh pi@octopi.local
If you're using Windows, then you'll need an ssh program. The most common (free) ssh program for windows is called putty, and if you google it, then you can find where to download it from. Open it and tell it to connect to either pi@octopi.local or pi@<insert_ip_address_here>

Either way it will prompt you for a password. If you haven't changed it, it will be raspberry (but in that case, you really should change it with the passwd command once you log in.

Then it will present you with a prompt, which will look something like pi@octopi-mini:~ $ (yours will likely say octopi rather than octopi-mini. I changed the hostname of mine to distinguish it from the octopi instance that will be controlling my other printer)

At the prompt, you can run the id command, and it will show you information about the current user. The default user is pi, so it should look something like:

uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),5(tty),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),997(gpio),998(i2c),999(spi)

In the groups line check to make sure that the pi user is in the video group. (it is on mine).

If that's the problem, you can add pi to the video group by running the command sudo usermod -a -G video pi (it will prompt you for the same password). and then reboot the pi. Very important... I originally forgot the -a option to usermod, and that will make the pi user ONLY be part of the video group, which will break lots of stuff. I apologize if this happened to you.

If that isn't the problem, plug in the camera and try the command ls -l /dev/video* and see what that produces.

Also run the command that Charlie suggested above: v4l2-ctl --list-devices. on mine it looks like:

pi@octopi-mini:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
	/dev/video10
	/dev/video11
	/dev/video12
	/dev/video18

bcm2835-isp (platform:bcm2835-isp):
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16

USB 2.0 Camera: USB Camera (usb-0000:01:00.0-1.1):
	/dev/video0
	/dev/video1

And if it looks similar then try the command dmesg to see if the video device is recognized (it will produce a lot of output, but the last few lines should have the event of plugging in the camera and which device it was assigned)

If you cant find the device with dmesg, then we can dig into it using sudo lsusb
On mine it looks like:

pi@octopi-mini:~ $ sudo lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 2c99:000c  
Bus 001 Device 003: ID 0c45:6367 Microdia 
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The camera is Microdia, which you can see if you run sudo lsusb -v | less (This will run the command and then present it one screenful at a time. the spacebar will go to the next page, and the / key will search.
Type / and then Camera and return, and see what shows up.

Also you might want to try the command v4l2-ctl -D, which will show detailed information about the device driver. Mine looks like:

Driver Info:
	Driver name      : uvcvideo
	Card type        : USB 2.0 Camera: USB Camera
	Bus info         : usb-0000:01:00.0-1.1
	Driver version   : 5.10.103
	Capabilities     : 0x84a00001
		Video Capture
		Metadata Capture
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04200001
		Video Capture
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : uvcvideo
	Model            : USB 2.0 Camera: USB Camera
	Serial           : SN0001
	Bus info         : usb-0000:01:00.0-1.1
	Media version    : 5.10.103
	Hardware revision: 0x00000100 (256)
	Driver version   : 5.10.103
Interface Info:
	ID               : 0x03000002
	Type             : V4L Video
Entity Info:
	ID               : 0x00000001 (1)
	Name             : USB 2.0 Camera: USB Camera
	Function         : V4L2 I/O
	Flags         : default
	Pad 0x01000007   : 0: Sink
	  Link 0x02000013: from remote pad 0x100000a of entity 'Extension 4': Data, Enabled, Immutable


Okay, I gave up on this for a while because nothing was working. This is where I'm at. (see attached). As you will see, none of the commands work. My camera has not worked for a long time now. I would really like to have a camera. Does anyone see anything that I can check?

okay, seems that I found the solution. Thanks all.