opencv_ffmpeg module crash (IP Camera)
I'm using IP webcam android app(It converts mobile camera into IP web camera).
I'm running below code in Visual Studio 2015 with OpenCV 3.1.
VideoCapture cap; Mat img;
cap.open("http://192.168.0.101:8080/video?x.mjpeg");
while(waitKey(33)!=27)
{
try{
cap>>img; //code crashes here
if(img.empty())
{
cout<<"camera Closed"<<endl;
break;
}
imshow("Video",img);
} catch(...{}
}
Getting below error. If the internet connection is slow or if the Wi-Fi is disconnected in my android device the program crashes
Error:
Exception thrown at 0x0BF2F6F0 (opencv_ffmpeg310.dll) in test.exe: 0xC0000005: Access violation reading location 0x00000020.
If there is a handler for this exception, the program may be safely continued.
even if the code is wrapped within try catch block, it crashes!
Should I use try {} catch (...) block in source file, if yes, then where should I use this?
I referred this link but did not find the right answer.
check if cap is opened using isOpened method before while loop
cap.IsOpened()
always returns true even when Wi-Fi is turned off.