cv::VideoCapture works for webcams but not IP cameras
It had to happen, I'm stuck in the last phase of my project, when I want to use my code which works like a charm on my webcam, on an IP camera. The URL works perfectly in my browser, but nothing comes out with OpenCV... Here is my code:
#include <opencv/highgui.h>
using namespace cv;
int main(int argc, char *argv[])
{
Mat frame;
namedWindow("video", 1);
VideoCapture cap("http://192.168.1.99:99/videostream.cgi?resolution=32&rate=0&user=admin&pwd=password&.mjpg");
while ( cap.isOpened() )
{
cap >> frame;
if(frame.empty()) break;
imshow("video", frame);
if(waitKey(30) >= 0) break;
}
return 0;
}
And the compiler settings :
//Added to the .pro file of QtCreator
INCLUDEPATH += C:\\OpenCV243\\release\\include
LIBS += -LC:\\OpenCV243\\release\\lib \
-lopencv_core243.dll \
-lopencv_highgui243.dll
I've tested opening a .avi file with the same code and it works... But a public IP camera URL like http://66.184.211.231/mjpg/video.mjpg
doesn't ! What's the matter then ?
Thanks for your help,
Regards, Mister Mystère
had the same problem on xp, trying to access an ipcam would never leave cap.open() it just got stuck there.
it seems to work much better running linux or such