We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everybody. I'm trying to connect Ip camera of VISTALINE with processing but I can not get live image in sketch. Console always shows: Unable to open I/O streams: Server returned HTTP response code: 502 for URL: http://192.168.0.129:80/axis-cgi/mjpg/video.cgi?resolution=320x240
The code & IP configuration of camera are shown as pictures below:
IPCapture cam;
void setup() {
size(320,240);
cam = new IPCapture(this, "http://192.168.0.129:80/axis-cgi/mjpg/video.cgi?resolution=320x240", "admin", "admin");
cam.start();
// this works as well:
// cam = new IPCapture(this);
// cam.start("url", "username", "password");
// It is possible to change the MJPEG stream by calling stop()
// on a running camera, and then start() it with the new
// url, username and password.
}
void draw() {
if (cam.isAvailable()) {
cam.read();
image(cam,0,0);
}
}
void keyPressed() {
if (key == ' ') {
if (cam.isAlive()) cam.stop();
else cam.start();
}
}
Anybody can help me,please?
Answers
Hi. After 2 days, I know my problem. IP capture library only support MJPEG stream while my IP camera export h264 stream (I don't know exactly what it is but surely it's not MJPEG format).
So for someone who may concern: Make sure your IP camera export MJPEG stream before try to connect it to Processing using IPCapture library.
Thank you for sharing your problem detective work.
One option (untested) you could try using to transcode the stream -- take in the h264 stream and send out a new MJPEG stream. For example, using VLC:
...or get an MJPEG camera instead, of course.
@jeremydouglass. Thank you very much for your advice. I'll try and update the result later.