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

1 Like

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.

Hi,
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

2020-04-27_15-18-52

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 127.0.0.1) 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 127.0.0.1

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

5 Likes

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.

Same thing. Here is what I see when I go to snapshot screen.:


I've included from the Timelapse, showing it had 96 frames before it quit, the results of octopi.local:8080, Web Cam streamimg, and error of capture timelapse.
I've tried the most current version of Edge and Chrome, and Firefox.Same results.
Thank-You

It feels like the mjpg_streamer service isn't running on the instance (in your case).

I think I'd go back to basics. Verify both ribbon cable end connections and orientation of the cable. Look for the red power LED on the small board for the webcam.

Hi OutsourcedGuru,
I'm not certain if you are replying to Bruce_Meyer or the person whose post I replied to.
If me, I have verified, and I can watch video up until the print job begins, and then a bit longer. (Notice it made 96 frames before dying) If I don't do anything and just leave it on 'Control' I have videofromt he camera. It seems like when I start something else, thats what kills it. I did install the full gui, but have it 'not starting at boot time'
Its a Raspberry Pi 4b.

On the other hand... If you were replying to the post above mine, forgive me, I'm not too clear on how the forumn works yet, and I'll just sit over here and be quiet. :slight_smile:

1 Like

That is the problem when you attach your problem to an open thread: Over time no one knows who is talking to who.
For the time gap between the last post in the thread an your first post, I assume @OutsourcedGuru is referring to you.
But it's always better to open a new thread.

1 Like

Even better is to add a reference the old thread in your new one! That along with all the detail the get help template asks for and we have the best chance possible of actually providing help!

1 Like

Bruce, I tend not to reply to posts older than a month and yours was the "freshest" on here. Also, since you replied to my post, I was replying to back to you in response (another clue).

What we know:

  • You are running OctoPrint from a 4B
  • Its hostname is still octopi.local so we assume you flashed the octopi IMG file to bring in the mjpg_streamer support out-of-the-box
  • The daemon on port 8080 is technically responding, yielding the HTML you see; you just see neither the snapshot image nor the stream
  • OctoPrint is complaining that it can't fetch the snapshot using the localhost version of this.
  • You got some frames to display before it tweaked out.
  • You have access control turned on and you're logged in
  • We don't know if you're using a webcam attached via ribbon or USB cable

From what I understand, IE/Edge may have a problem displaying the webcam as an <img /> object in the Control tab. And yet, you've also tried other browsers.

I need to do a better job of paying attention how to request help.
I am using a Pi Camera from CanaKit attached to the ribbon cable. I have removed and reseated carefully, both ends.
I am using Chrome, current version.
In case it was resource bound, I uninstalled the gui using:
sudo apt-get remove --yes raspberrypi-ui-mods
sudo apt-get purge
sudo apt-get autoremove
Thank-You