Webcam stream not working

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)

Created an account just to like this comment because my webcam stopped streaming for some reason, and your comment helped bring the stream back!

1 Like

Thanks for this thread!
I just moved my raspi4 from wifi to ethernet and had both ips still assigned and running.
Octoprint was working, webcam not.

Added the dtoverlay=disable-wifi to /boot/config.txt, reboot - webcam working again :slight_smile:

Webcam stream not loaded

It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Webcam" > "Stream URL". If you don't have a webcam you can also just disable webcam support there.

Currently configured stream URL: http://octopi.local/

can anyone tell me what the stream url is for local pi on their octoprint

If you are running OctoPi specifically, then use /webcam/?action=stream

Absolute noob so please excuse me. I've read through the thread and haven't found an answer!

My Snapshot URL works (when i press Test an image appears)
My Stream URL however does not work (no image appears)

So my Snapshot URL is http://11.2.3.4:8080/?action=snapshot
And i've tried http://11.2.3.4:8080/?action=stream

I don't know what 11.2.3.4:8080 is (obviously not the actual IP
It's neither my WiFi IP nor my RaspberryPi IP

Cheers!!


Edit 2/
It was working btw, i deleted the url by accident :man_facepalming:

i did the same. it was working, deleted the url by accident, and now im in search for it

I replied to you above already, you don't need to keep searching!

Same for @PixelatedPolyurethan - the default URL for OctoPi is above. If you aren't using OctoPi you will need the IP of the webcam server in there.

2 Likes