Configuration of a wifi camera

Hi,
I cannot get my IP camera (ESCAM G02) working with Octoprint.
I assigned a fixed IP address to the camera and I can ping it from opctopi .
I can open the camera UI from a web browser connected to the same network and can see activity but I cannot see anything from octoprint.
I have tried many things with no success:
I have set:
htttp://cam IP:8080/action?=stream
htttp://cam IP:80/action?=stream
htttp://cam IP/action?=stream

Same for snapshot but I am probably missing something.

My version of octopi is the latest 0.15.0 and I am running on a B+ model.

Thanks in advance to anybody who can help.

I have a foscam that I use outside of Octoprint. I thought it'd be a neat idea if I could have it be PART of my Octo, but, it won't cooperate at all

My assumption was that it was an issue with the fact that it requires a username and password

The ESCAM G02 also requires a username and password, how, exactly, is Octoprint supposed to access your camera and integrate it into its system without credentials ?

There isn't a spot in Octoprint (that I have found) to integrate a camera that requires credentials. Maybe I'm missing some simple button, but, I don't think there would be a way to do this without some sort of plugin to allow for credentials to be entered BY Octoprint before you could achieve what you are attempting. And then add to it the existence of the control buttons (that also don't exist in Octoprint) adds yet another layer of complication

Thanks Spyder.
I could get streaming from a usb webcam connected to octopi quite easily but having the wifi with its IR mode would be definitely more exciting.

You're welcome. USB webcam is all it supports as far as I know

May be using rtsp like this woul dbe an option: rtsp://192.168.X.X:554/user=YOUR_USERNAME&password=YOUR_PASSWORD&channel=1&stream=0.sdp?real_stream--rtp-caching=100
Could not get it running still because It seems VLC plugin is necessary for rtsp.
ONVIF seems to be another option but I guess a plugin would also be necessary.

I think I would visit the native webpage for the camera, something like simply:

http://192.168.1.15/

...and do a View Source to see if it's returning HTML or something like mjpg, for example. It's likely HTML. Somewhere in that HTML will be a reference to the actual sub-URL for the content itself. I'd grab that URL and then bring it into OctoPrint.

It looks like the default port is 80 on this one, btw. And since all that /?action=stream is how you'd talk to mjpg-streamer and not this camera, you can forego doing that.

I tried with my own IP camera, and, like I said, it's not gonna be that straight forward

Here's what mine looks like...


The only thing that looks even potentially hopeful is where the cgi at least produces a partial image.

The cloud only has a local address (the geolocation is irrelevant, but troubling, but, there's nothing there anyway)

I can see that there's a way to do it, but, not something easy

I still say it would require a plugin, and, more than likely, a different plugin for each brand

Here's two different code examples, both for my foscam, but, it's an example of what you'd need
<img src="http://DDNSorISPIPAddress:PortForCamera/snapshot.cgi?user=CameraVisitorId&pwd=YourPassword&t=" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 5000)' alt='' />

and
<img src="http://DDNSorISPIPAddress:PortForCamera/CGIProxy.fcgi?cmd=snapPicture2&usr=CameraVisitorId&pwd=YourPassword&t=" onload='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 1000)' onerror='setTimeout(function() {src = src.substring(0, (src.lastIndexOf("t=")+2))+(new Date()).getTime()}, 5000)' alt='' />

Let's take a look at the first reference, then.

# This appears to be the interface for pulling a snapshot from the camera and they're using an IMG tag so that seems to confirm my suspicion:
http://DDNSorISPIPAddress:PortForCamera/snapshot.cgi?user=CameraVisitorId&pwd=YourPassword&t=

# And then when the IMG tag gets loaded, it fires off this JavaScript handler.
# This will run after one second's delay to decorate a time-based nonce at the
# end of the URL to defeat any caching mechanisms and to reload the image:
setTimeout(function() {
    src = src.substring(0, (src.lastIndexOf("t=")+2)) +
          (new Date()).getTime()
}, 1000);

# Similarly, if there's an error refreshing the snapshot image, it will push the refresh
# to five seconds instead.

So basically, it's a poor-man's video. It will pull a new snapshot every second and play games to make sure that your browser doesn't cache the previous version.

So now, how to make some awesome out of all this? I think I would roll over to this post about how to configure mjpg-streamer and plug in the original poster's snapshot URL instead of the standard one that OctoPrint uses.

Yea, I just tried that. Tried mine too, which, theoretically, should have worked. But, I'm probably looking for a complicated answer where a simple one should work

This appears to be the documentation for the section in config.yaml to point OctoPrint's interface to whatever is responsible for streaming. Most of these are exposed to the Timelapse tab in OctoPrint. Mine looks like this:

webcam:
  ffmpeg: /usr/bin/avconv
  snapshot: http://127.0.0.1:8080/?action=snapshot
  stream: /webcam/?action=stream
  timelapse:
    fps: 25
    options:
      interval: 10
    postRoll: 2
    type: timed

So... it looks like for a photo, they're pulling directly from the mjpg-streamer service that's on 8080. But for video, they're going through the local /webcam page.

Reviewing OctoPrint, it looks like a lot of heavy lifting is going on in ~/oprint/lib/python2.7/site-packages/octoprint/timelapse.py.

OctoPrint routes (like to /webcam) appear to be in octoprint/server/__init__.py in the self._router.urls array. I'm just not seeing that route. So... it must be hiding in a plugin.

I can't find that route. meh

I Have the same problem as you guys, with a dlINK dcs-5222L.

In a browser, I can stream in mjpeg from a browser using an url like this: http://ursename:password@192.168.0.232/video1.mjpg

But in Octoprint, I only get a broken icon. I've tried everything I can think of, to no avail. Any new ideas ?

André

Have you tried replacing the stream URL in the settings (or in config.yaml) with the URL you indicated below?

Hi everyone. I, with my ipcamera,solved by putting these 2 url (taken from the page generated by the cam):
-http://ipaddress:port/videostream.cgi?user=username&pwd=password
-http://ipaddress:port/snapshot.cgi?user=username&pwd=password
Replace ipaddress, port, username and password.
The first is for streaming and the second one for taking snapshot.
Bye

2 Likes

Hello! Sorry for necro-bump, but I faced with same problem and decided to share my workaround here. I wrote simple python script which proxy requests to IP Camera and authenticates requests for you.

Here is github sources and here is docker image on DockerHub.

I set up the RPi-Cam-Web-Interface from RPi-Cam-Web-Interface - eLinux.org. I set my Classic Camera Stream URL to http://RPi_Cam_IPAdd/html/cam_pic_new.php and everything worked. I'm sure there are better options, but I'll use this until I get time to figure out something better.