Reputation: 2607
I am trying to connect to my dlink ip camera using the following code:
//CvCapture *camera = cvCreateFileCapture("rtsp://admin:[email protected]:554/0/1:1/main");
CvCapture *camera = cvCreateFileCapture("rtsp://admin:[email protected]:554/ch1-s1");
if (camera == NULL) {
printf("camera is null, aborting...");
return;
}
printf("camera is not null\n");
fflush(stdout);
cvNamedWindow("img");
while (cvWaitKey(100) != 27) {
IplImage *img = cvQueryFrame(camera);
if (img == NULL) break;
cvShowImage("img", img);
}
cvReleaseCapture(&camera);
and I am getting the following ERROR:
[tcp @ 0x103252d80] Connection to tcp://192.168.2.74:554?timeout=0 failed: Connection refused WARNING: Couldn't read movie file rtsp://admin:[email protected]/ch1-s1
camera is null, aborting...Program ended with exit code: 0
any ideas appreciated, thanks
Upvotes: 2
Views: 2514
Reputation: 1314
I think your problem is with the url.Try this:
"http://USER:PWD@IPADDRESS:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";
Upvotes: 2