user2449986
user2449986

Reputation: 77

IPCapture library for Processing returns error

I've been trying to use this library:

ipcapture: Processing library for MJPEG stream acquisition from IP cameras

But I'm not having any luck. I've tried Processing 2 and 3 on a Mac, and keep getting this error:

Unable to open I/O streams: Server returned HTTP response code: 401 for URL: http://192.168.0.14/videostream.cgi

The Foscam IP camera streams to a webpage like this:

http://192.168.0.14/videostream.cgi?user=admin&pwd=

So in Processing I used this:

cam = new IPCapture(this, "http://192.168.0.14/videostream.cgi", "admin", "");

What am I overlooking or misinterpreting?

Thanks.

Upvotes: 0

Views: 716

Answers (1)

ngeosone
ngeosone

Reputation: 26

401 is UnAuthorized, probably means your password did not go through.

I would try still sending the authentication as part of the url.

Try this 1) cam = new IPCapture(this, "http://192.168.0.14/videostream.cgi?user=admin&pwd=", "", "");

And comment out

 try {
  conn = (HttpURLConnection)url.openConnection();
  //comment out the following line.
  //conn.setRequestProperty("Authorization", "Basic " + base64.encode(user + ":" + pass));
  httpIn = new BufferedInputStream(conn.getInputStream(), 8192);
}
catch (IOException e) {
  System.err.println("Unable to connect: " + e.getMessage());
  return;
}

I'm going by what i found at https://code.google.com/p/ipcapture/source/browse/src/IPCapture.java?r=5f5996377689334b4bb7c1d24319f4932694f4a8

Hope it helps!

Upvotes: 1

Related Questions