1

I am trying to display video feed from IP- Camera(D-Link DCS 932L). I Have gone through topics for the same and tried the code from different posts, but am unable to get the video feed from the camera. Here's the code which i tried.

#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;

int main(int argc, char *argv[])
{
Mat frame;
namedWindow("video", 1);
String url = "http://admin:admin@172.32.20.55:80/image/jpeg.cgi";
VideoCapture cap(url);
/*   VideoCapture cap(0);*/
while ( cap.isOpened() )
{
    cap >> frame;
    if(frame.empty()) break;

    imshow("video", frame);
    if(waitKey(30) >= 0) break;
}

return 0;

}

I tried many different kind of url's but i was unable to display any video feed. I thought it might be code problem so I even tried displaying the USB Webcam and it worked. So now i come to conclusion that the problem seems to be with URL which am passing. Heres the list of urls which I tried. I got this Url options from iSpy.Here are those URL's

(JPEG)http://admin:admin@172.32.20.55:80?IMAGE.JPG
(JPEG)http://admin:admin@172.32.20.55:80/image/jpeg.cgi
(MPEG)http://admin:admin172.32.20.55:80/video.cgi?resolution=VGA
(MPEG)http://admin:admin172.32.20.55:80/video/mjpg.cgi
(MPEG)http://admin:admin172.32.20.55:80/mjpeg.cgi?        user=admin&password=admin&channel=0
(MPEG)http://admin:pnqadmin172.32.20.55:80/VIDEO.CGI

Please let me know what can be probable problem for displaying the video feed. Is their something to do with the setting of the OpenCv or something else.Please note that am using VS2010 and C++ Need help of all the Expert out their. Thanks in advance.

Mayur
  • 789
  • 10
  • 37

3 Answers3

2

I solved my problem. The problem was with URL. I changed the URL and it worked smooth..! The URL i used was as follows.

"http://USER:PWD@IPADDRESS:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";
Mayur
  • 789
  • 10
  • 37
0

I keep getting the same error:

warning: Error opening file <../../modules/highgui/src/cap_ffmpeg_impl.hpp:529>

I was trying to stream MJPG video from a Foscam IP camera. The URL opened just fine but I couldn't read any frames. May be there was some problem with the video codec.

Here's a hack written in Python that worked for me: https://stackoverflow.com/a/18411168/3183051

Community
  • 1
  • 1
ericman314
  • 41
  • 3
0

Perhaps my answer is too late. Check if opencv_ffmpegXXX.dll or opencv_ffmpegXXX_64.dll (if you are building 64bit executable) is in the same folder where your executable is. Replace XXX with the number of opencv version you use.

tmp
  • 1