Webcam works when testing, but not in Control tab

Camera model
Generic IP Camera

What is the problem?
Camera feed doesn't show up in Control tab, but works fine when testing feed in Settings.

What did you already try to solve it?
Restart Octoprint.
Read Webcam test in settings works but fails to load in control tab, but no answer.

Logs (/var/log/webcamd.log, syslog, dmesg, ...)
All it says is:

Starting up webcamDaemon...

--- Configuration: ----------------------------
camera: auto
usb options: -r 640x480 -f 10
raspi options: -fps 10
http options: -w ./www-octopi -n

No camera detected, trying again in two minutes

Additional information about your setup (OctoPrint version, OctoPi version, ...)
OctoPi version 0.16.0

You didn't mention which browser you're using. Microsoft IE isn't very compatible with the <img src="url" /> method that's used in OctoPrint on that tab.

Sorry, I tried Google Chrome, Microsoft Edge, and iOS Safari.

Okay, so you're using an IP camera rather than something physically connected to the Raspberry Pi 3B. The webcam daemon that's running on the Pi has suggested that it doesn't see a camera attached to the ribbon cable connector.

Did you visit the Settings -> Timelapse & Webcam page to adjust the stream URL (having researched what this should be)?

Yes. The stream URL is cameraip:8081/video and it works fine.

image

It seems as though Octoprint is appending numbers to the URL, causing it to return a 404 error. Is there a way to fix this?

Edit: Looks like this has happened before - Another Webcam Issue. Looks like its changing the URL?
I'm not sure how the problem got solved, it mentioned Resource Override, a Google Chrome extension, but I'm not sure how to set that up as no instruction was provided in that thread.

Ok, I solved the problem, although it only solves it for Google Chrome on my computer.

Download Resource Override, a Chrome extension: https://chrome.google.com/webstore/detail/resource-override/pkoacgokdfckfpndoffpifphamojphii?hl=en

Open it up. Where it says Tab URL, add the URL of your Octoprint interface. Example: http://192.168.0.42/#control

Make sure you have the #control at the end.

Click Add Rule, then URL ----> URL.

In the From box, put your webcam URL with an asterisk at the end like this: http://192.168.0.43:8081/video*

In the To box, put your webcam URL as is, like this:
http://192.168.0.43:8081/video

The issue should be fixed!

1 Like

As I mentioned in the similar thread, decorating the end of a URL with a question mark plus a nonce (an incremented number) is a classic way of defeating browser-side caching mechanisms. The people who provided the IP camera should know this, you'd think.

There's probably also a way of doing this using the Themeify plugin to overwrite the URL from a hard-coded way.

It's an IP Camera app on an iPhone, so I don't expect much. I might go out and buy a wired webcam because the IP Camera app can't do snapshots, from what I've been trying.

Either that or look into a different IP camera app. If you want a decent and reasonably priced webcam, check out the Logitech C920. It can often be found on sale for less than 50 USD.

Nonce strikes again! Any idea how this could be useful for a camera stream? I don't think those are ever cached, right? I wonder what the motivation for this was. Perhaps error messages are cached sometimes?

Unfortunately, the Control tab uses the <img src="http://localhost:8080/?action=stream" /> construct or similar so it's not like it's seen by the browser as a video object. Presumably foosel put that in there for a reason. It's just breaking things for IP camera web interfaces which are unforgiving of decoration like this.

For anybody else that comes across this from a google search, and you're using Chrome - Just go ahead and press "Ctrl + Shift + R" to reload the page which doesn't use any current cookies and recreates the page from a new load, and the camera will show up.

1 Like