Configuration of a wifi camera


#1

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.


#2

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


#3

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.


#4

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


#5

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.


#6

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.


#7

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


#8

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='' />


#9

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.


#10

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


#11

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


#12

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é


#13

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


#14

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