Webcam stream not working

okay lets lay it out again from the beginning.

I have my octoprint running and well on a raspberry 3a+, i can reach it by typing its ip adress in the browser, no problems there.
so ive bought a picam with flat cable and followed the tutorial on the octoprint website, enabled picam in the sudo raspi-config section. when i start the streamer by SSH, the led on the picam comes on.

first of all on the octopi main page the webcam stream keeps loading like in the case of the dude that started this topic, only the text is in english.:wink:

if i try to reach the camera by : myPrintersIPadress:8080/ i get the following message: 501: not implemented. this should work.
if i try myPrintersIPadress:8080/?action=stream , the page keeps on loading infinitly. this also should work.
when i kill the streamer by SSH the LED goes off and both of the pages i just mentioned go offline. (very important detail here)

so bonjour or not, i can reach my printer just fine, but not the webcam.
im using firefox the whole time btw.

anyone else ran in to the same problems?

If it were me, I'd remote into the Pi and run:

curl -v http://localhost:8080/

I would take a look at what was returned (if anything). Here's what I see on mine:

* Expire in 0 ms for 6 (transfer 0xdfb7c0)
# many of those, repeated
*   Trying ::1...
* Expire in 149998 ms for 3 (transfer 0xdfb7c0)
* Expire in 200 ms for 4 (transfer 0xdfb7c0)
* Connected to localhost (::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 200 OK
< Content-type: text/html
< Connection: close
< Server: MJPG-Streamer/0.2
< Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
< Pragma: no-cache
< Expires: Mon, 3 Jan 2000 12:34:56 GMT
<head><title>mjpg_streamer test page</title></head>
<p>Refresh the page to refresh the snapshot</p>
<img src="./?action=snapshot" alt="Snapshot">
<img src="./?action=stream" alt="Stream">
* Closing connection 0

So when this is working correctly the Pi is serving up just a simple webpage with a couple of links. If your install isn't serving up (locally) on the Pi this content then troubleshoot this as a haproxy problem. Assuming that it does return a webpage then the next step locally on the Pi is to see if you can fetch a screenshot image.

curl -o ~/screenshot.png http://localhost:8080/?action=snapshot
ls -l ~/screenshot.png
  -rw-r--r-- 1 pi pi 39230 Oct 29 11:56 /home/pi/screenshot.png

Personally, I would use scp to fetch that file over to my workstation and see if it's what's expected.

Thanks for the input, but the camera was busted, bought a different one and now its running perfectly. only one thing, when i reboot the pi the streamer doesn't automagically start, i have to do that by hand true ssh. is there a way that it can automagically start by itself?

1 Like

pi@octopi:~ $ curl -v http://localhost:8080/

  • Trying ::1...
  • connect to ::1 port 8080 failed: Connection refused
  • Trying
  • connect to port 8080 failed: Connection refused
  • Failed to connect to localhost port 8080: Connection refused
  • Closing connection 0
    curl: (7) Failed to connect to localhost port 8080: Connection refused
    pi@octopi:~ $

i get this by the way, this is when i dont start the mjpg-streamer

If you installed OctoPrint using the OctoPi image then the webcam support should automatically start at bootup for you.

Otherwise, foosel has created a step-by-step guide here; jump down to the webcam part.

Hi i downloaded the latest bundled octopi image 0.17.0 and installed it on my pi 3B+. But my Logitech C905 Webcam didn't work (black screen with Web cam stream loading). On a previous version of Octopi (0.15.0) it worked without a problem. So i installed the older image and it works fine again.
Is anything changed since the 0.15.0 version that prevents this old webcam from working?

In 0.17.0 i could see the webcam connected to the USB port with sudo lsusb .
image but the camera didn't start streaming.

I'm not aware of anything significantly changed that would have done this.

I seem to have a similar problem to damen.

I recently downloaded the latest octopi image (0.17) aswell, and installed it on my Raspberry Pi 3 Model B Rev 1.2.
I was coming from version (0.14), in which the camera was working fine (and so were time lapses).
The camera is too a Logitech C905 Webcam. The camera still works on other devices.
I have tried as mentioned in this thread. http://octopi.local:8080/, which just gives


but no webcam image.

The pi can see the camera fine
Bus 001 Device 007: ID 046d:0991 Logitech, Inc. QuickCam Pro for Notebooks

Seems like Damen and I have almost identical issues.

Hey Guys, i think i have a workaround for you. It seems very picky at least on mine, ubuntu 16.04.

instead of doing localhost (localhost or try putting your actual IP in there instead. http://192.168.X.XXX:8080/

I was changing octoprint system IP and when the camera stopped working. I realize its old IP is listed in URL. i thought hmm let me make this localhost, but no it doesnt like it.

i was also able to use the PC hostname (or computer name). Im pretty sure is an octoprint issue because other stuff can access it on localhost. HTH

edit: octolapse doesnt seem to mind being localhost ip

I ended up getting it working by accessing the pi by ssh and the running the following commands followed by a reboot of the raspberry pi

sudo apt-get update --fix-missing

sudo apt-get upgrade

(Checked the camera was enabled after running the updates)

sudo raspi-config

sudo reboot

Having the same issues with a Microsoft Lifecam.
Trying geotech's solution, boy that is a big list of updates!
It's not done yet, if it needs a reboot i'll have to wait until the print i am doing is finished.

I' ll let you people know...

It seems it needs a reboot.
sudo systemctl restart webcamd did it, i hope it stays like that after a reboot.

Kudos to geotech!

Well, it's ok for a few seconds then it looses the connection...

Waiting for the reboot...

Done, it seems fine after the reboot.