C++ opencv_ffmpeg模块崩溃(IP摄像头)

C++ opencv_ffmpeg模块崩溃(IP摄像头),c++,opencv,error-handling,ffmpeg,runtime-error,C++,Opencv,Error Handling,Ffmpeg,Runtime Error,我使用的是IP网络摄像头android应用程序(它将移动摄像头转换为IP网络摄像头)。我使用OpenCV 3.1在Visual Studio 2015中运行以下代码 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

我使用的是IP网络摄像头android应用程序(它将移动摄像头转换为IP网络摄像头)。
我使用OpenCV 3.1在Visual Studio 2015中运行以下代码

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(...{}    
}
videocap;Mat-img;
第1章开放(”http://192.168.0.101:8080/video?x.mjpeg");
while(waitKey(33)!=27)
{
试一试{
cap>>img;//代码在此崩溃
if(img.empty())
{

coutI只能假设cap.open()失败。在读取之前,您需要检查它是否有效。摄像头打开。我们可以观看视频,直到Wi-Fi关闭。
cap.IsOpened()
始终返回true,即使Wi-Fi关闭@WLGfxI只能假设cap.open()已失败。在读取之前,您需要检查它是否有效。摄像头打开。我们可以观看视频,直到关闭Wi-Fi。
cap.IsOpened()
始终返回true,即使Wi-Fi已关闭@WLGfx