Webcam stream not working

pi@octopi:~ $ journalctl -u webcamd
-- Logs begin at Thu 2019-02-14 10:11:59 GMT, end at Sat 2020-12-26 15:14:38 GMT
dez 26 14:17:04 octopi systemd[1]: Starting the OctoPi webcam daemon with the us
dez 26 14:17:04 octopi webcamd[346]: Starting up webcamDaemon...
dez 26 14:17:04 octopi webcamd[346]: --- Configuration: ------------------------
dez 26 14:17:05 octopi webcamd[346]: cfg_file: /boot/octopi.txt
dez 26 14:17:05 octopi webcamd[346]: camera: auto
dez 26 14:17:05 octopi webcamd[346]: usb options: -r 640x480 -f 10
dez 26 14:17:05 octopi webcamd[346]: raspi options: -fps 10
dez 26 14:17:05 octopi webcamd[346]: http options: -w ./www-octopi -n
dez 26 14:17:05 octopi webcamd[346]: Explicitly USB device:
dez 26 14:17:05 octopi webcamd[346]: -------------------------------------------
dez 26 14:17:05 octopi webcamd[346]: Found video devices:
dez 26 14:17:05 octopi webcamd[346]: /dev/video10
dez 26 14:17:05 octopi webcamd[346]: /dev/video11
dez 26 14:17:05 octopi webcamd[346]: /dev/video12
dez 26 14:17:05 octopi webcamd[346]: /dev/video13
dez 26 14:17:05 octopi webcamd[346]: /dev/video14
dez 26 14:17:05 octopi webcamd[346]: /dev/video15
dez 26 14:17:05 octopi webcamd[346]: /dev/video16
dez 26 14:17:05 octopi webcamd[346]: config file='/boot/octopi.txt':USB device w
dez 26 14:17:05 octopi webcamd[346]: [69B blob data]
dez 26 14:17:05 octopi webcamd[346]: <13>Dec 26 14:17:05 root: Starting USB webc
dez 26 14:17:05 octopi webcamd[346]: Running ./mjpg_streamer -o output_http.so -
lines 1-23...skipping...
-- Logs begin at Thu 2019-02-14 10:11:59 GMT, end at Sat 2020-12-26 15:14:38 GMT
dez 26 14:17:04 octopi systemd[1]: Starting the OctoPi webcam daemon with the us
dez 26 14:17:04 octopi webcamd[346]: Starting up webcamDaemon...
dez 26 14:17:04 octopi webcamd[346]: --- Configuration: ------------------------
dez 26 14:17:05 octopi webcamd[346]: cfg_file: /boot/octopi.txt
dez 26 14:17:05 octopi webcamd[346]: camera: auto
dez 26 14:17:05 octopi webcamd[346]: usb options: -r 640x480 -f 10
dez 26 14:17:05 octopi webcamd[346]: raspi options: -fps 10
dez 26 14:17:05 octopi webcamd[346]: http options: -w ./www-octopi -n
dez 26 14:17:05 octopi webcamd[346]: Explicitly USB device:
dez 26 14:17:05 octopi webcamd[346]: -------------------------------------------
dez 26 14:17:05 octopi webcamd[346]: Found video devices:
dez 26 14:17:05 octopi webcamd[346]: /dev/video10
dez 26 14:17:05 octopi webcamd[346]: /dev/video11
dez 26 14:17:05 octopi webcamd[346]: /dev/video12
dez 26 14:17:05 octopi webcamd[346]: /dev/video13
dez 26 14:17:05 octopi webcamd[346]: /dev/video14
dez 26 14:17:05 octopi webcamd[346]: /dev/video15
dez 26 14:17:05 octopi webcamd[346]: /dev/video16
dez 26 14:17:05 octopi webcamd[346]: config file='/boot/octopi.txt':USB device w
dez 26 14:17:05 octopi webcamd[346]: [69B blob data]
dez 26 14:17:05 octopi webcamd[346]: <13>Dec 26 14:17:05 root: Starting USB webc
dez 26 14:17:05 octopi webcamd[346]: Running ./mjpg_streamer -o output_http.so -
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: starting applica
dez 26 14:17:05 octopi webcamd[346]: MJPG Streamer Version: git rev: 501f6362c5a
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: MJPG Streamer Ve
dez 26 14:17:05 octopi webcamd[346]: i: Using V4L2 device.: /dev/video10
dez 26 14:17:05 octopi webcamd[346]: i: Desired Resolution: 640 x 480
dez 26 14:17:05 octopi webcamd[346]: i: Frames Per Second.: 10
dez 26 14:17:05 octopi webcamd[346]: i: Format............: JPEG
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: Using V4L2 devic
dez 26 14:17:05 octopi webcamd[346]: i: TV-Norm...........: DEFAULT
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: Desired Resoluti
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: Frames Per Secon
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: Format..........
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: TV-Norm.........
dez 26 14:17:05 octopi webcamd[346]: Error opening device /dev/video10: video ca
dez 26 14:17:05 octopi webcamd[346]: Init v4L2 failed !! exit fatal
dez 26 14:17:05 octopi webcamd[346]: i: init_VideoIn failed
dez 26 14:17:05 octopi mjpg_streamer[467]: MJPG-streamer [467]: init_VideoIn fai
dez 26 14:17:06 octopi webcamd[346]: Done bring up all configured video device
dez 26 14:17:06 octopi webcamd[346]: Goodbye...
dez 26 14:17:06 octopi systemd[1]: webcamd.service: Succeeded.
dez 26 14:17:06 octopi systemd[1]: Started the OctoPi webcam daemon with the use
dez 26 14:17:06 octopi systemd[1]: webcamd.service: Service RestartSec=100ms exp
dez 26 14:17:06 octopi systemd[1]: webcamd.service: Scheduled restart job, resta
dez 26 14:17:06 octopi systemd[1]: Stopped the OctoPi webcam daemon with the use
dez 26 14:17:06 octopi systemd[1]: Starting the OctoPi webcam daemon with the us
dez 26 14:17:06 octopi webcamd[494]: Starting up webcamDaemon...
dez 26 14:17:06 octopi webcamd[494]: --- Configuration: ------------------------
dez 26 14:17:06 octopi webcamd[494]: cfg_file: /boot/octopi.txt
dez 26 14:17:06 octopi webcamd[494]: camera: auto
dez 26 14:17:06 octopi webcamd[494]: usb options: -r 640x480 -f 10
dez 26 14:17:06 octopi webcamd[494]: raspi options: -fps 10
lines 1-54

Looks like the camera was not found on the system.

Run vcgencmd get_camera, make sure you have it plugged in properly and there are no problems with the Pi's power supply such as undervoltage.

1 Like

pi@octopi:~ $ vcgencmd get_camera
supported=1 detected=0
Power supply looks adequate.

Well there you are, the camera is not detected. Something is probably wrong with the camera ribbon or the board itself. Make sure it is properly seated and the right way around.

So I thought I'd pop in with my odd findings. I was having a similar problem where the camera (USB Logitech C270) would work one day, and then fail to work on a reboot with no consistency.

I happened to get a new Raspberry Pi kit with a different power supply, and was troubleshooting at my PC with the new power supply. Worked on every start-up. Then I took it to my printer location with the old power supply, and it wouldn't load up. Camera starts ( camera LED on), then shuts down during Octoprint boot.

Moved the new power supply to the printer location and the camera is starting up without issue.

Old Power Supply: Came with Canakit Pi 4 Starter Kit.
New Power Supply: Came with Labists Pi 4 Starter Kit.

After a lot of tinkering with the cable with the pi turned off.
I'm getting:
pi@octopi:~ $ vcgencmd get_camera
supported=1 detected=1
but still no image.

now when i go to "control" i get " Webcam stream loading... "
I've reinstalled octoprint and issue remains.

Thanks this fixed my issue as well! Keep being awesome!

I have Octopi Version 0.18.0, running on Raspberry Pi 3 Model B Plus Rev 1.3

Ok, I have brand new installs of Octoprint, Feb 17, 2021, everything works except I can't get mjpg-streamer to come up. Within the Octoprint interface, the raspi cam Webcam tab displays the camera feed no issues.

However, when I browse to http://ipaddresss:8080 I recieve the following:
pi@octoender:/root/bin $ curl -v http://localhost:8080/

  • Expire in 0 ms for 6 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 1 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 2 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Expire in 0 ms for 1 (transfer 0x17de8a0)
  • Trying ::1...
  • TCP_NODELAY set
  • Expire in 149999 ms for 3 (transfer 0x17de8a0)
  • Expire in 200 ms for 4 (transfer 0x17de8a0)
  • connect to ::1 port 8080 failed: Connection refused
  • Trying 127.0.0.1...
  • TCP_NODELAY set
  • Expire in 149999 ms for 3 (transfer 0x17de8a0)
  • Connected to localhost (127.0.0.1) port 8080 (#0)

GET / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.64.0
Accept: /

  • HTTP 1.0, assume close after body
    < HTTP/1.0 400 BAD REQUEST
    < Content-Type: text/html; charset=utf-8
    < Content-Length: 192
    < Server: Werkzeug/1.0.1 Python/3.7.3
    < Date: Thu, 18 Feb 2021 15:10:29 GMT
    <
400 Bad Request

Bad Request

The browser (or proxy) sent a request that this server could not understand.

* Closing connection 0

That is because by default OctoPi no longer publicly exposes mjpg streamer on port 8080 anymore, however you should be able to access it just fine by going to http://<ip>/webcam/

It's the exact same response. http://octoender.local/webcam (I have two pi's both having exact same issue, each with unique hostnames) octoender and octolk1. Both produce same results, both were installed yesterday.

Try /webcam/, note the trailing slash.

Noted, and still doesn't work.

This is what is displayed when I enter http://192.168.0.181/webcam/ (this is the ip address of this octoprint install)

404: Not Found!
Could not open file

Yesterday, I installed a fresh Raspberry Pi 3B+ with the latest official Raspberry Pi OS and installed Octoprint according to the instructions here (but without venv). Everything works fine, except for the webcam stream.
Also, I installed a PiCamera with a ribbon cable and it works well with direct browser access. I have a stable stream (by a sophisticated python script that I successfully used a lot of times for other projects) that is shown in the settings, when I set up the camera stream and test it, but when I switch to the control tab, I just get the error message "Webcamstream nicht geladen" and it gives me the configured URL as link. When I click the link, it opens the perfectly working camera stream. The Web interface definitely handles the camera stream differently in the settings than in the control preview. Is there something to take care of regarding the resolution or codec settings? My stream is just a plain mjpeg that worked for me anywhere else and I'm quite at a loss here. I also tried all kinds of variants with local/network IPs and hostnames (which all work in all browsers) without success. The only thing I didn't configure is the snapshot URL, because I don't use snapshots, yet.

I had a similar issue and ultimately I had Internal networking issues...I had to go into my router and clear out all the pi IPs so dns would hit them again. Also, if you have more than one, be sure you have unique names. I have two and they are: octolk1.local/ and octrronxy3.local/

Raspi-config has host name setting.

Strange that it does not load in the space on the control tab, as far as I knew they were implemented the same/very similar, otherwise it wouldn't be much of a test. I can check.

If you open the browser error console, then try and load the webcam stream (switching tabs in the UI will make it re-load) see if there is an error loading it.

There is indeed an error in the control tab (thanks for the hint): It tries to append the number "1615037178376" (UNIX timestamp in milliseconds) as a query parameter to the actual URL, which leads to a 404 error. I can update my camera script to ignore such expressions in the URL for now, but I would prefer to keep the stream URL plain and simple. So is there a quick fix to keep the control tab from appending a timestamp?

I believe that is to stop the browser caching the image. I don't know of a way to stop it doing that, requests are open on GitHub to allow removing that but not implemented yet.

Probably the easiest way is to ignore query parameters in your script for now, maybe it would be a 'simple' configuration change in the front-end control tab logic to not add that, I don't think anyone has looked into it.

OK, thanks. This works now.

Guys I have a problem hopefully someone can help. So I have a webcam at home named whitcom (with 6 flashlight leds on it). I tried to connect it though octopi.txt and removing the # and changing the resolution and f, but nothing worked so far (I added a -y too). Then I stumbled upon this forum tried the http://octopi.local:8080/ , but that didn't work either. I know my webcam works because when I connect it to my raspberry pi 4 the flash lights are on, but I can't get an image. Hopefully someone can help me because this is getting frustrating.
https://www.amazon.nl/1-3-WEBCAM-CAMERA-MICROFON-SKYPE/dp/B0012XCW3M (this is the webcam)