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...
* TCP_NODELAY set
* 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
< 
<html>
<head><title>mjpg_streamer test page</title></head>
<body>
<h1>Snapshot</h1>
<p>Refresh the page to refresh the snapshot</p>
<img src="./?action=snapshot" alt="Snapshot">
<h1>Stream</h1>
<img src="./?action=stream" alt="Stream">
</body>
</html>
* 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...
  • TCP_NODELAY set
  • connect to ::1 port 8080 failed: Connection refused
  • Trying 127.0.0.1...
  • TCP_NODELAY set
  • connect to 127.0.0.1 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.