4

我运行一个类似于这个问题的程序:https ://stackoverflow.com/a/8719192/26070

#include <opencv/highgui.h>

#include <iostream>

/** @function main */
int main( int argc, char** argv )
{
    cv::VideoCapture vcap;
    cv::Mat image;

    const std::string videoStreamAddress = "rtsp://192.0.0.1:8081/live.sdp";

    //open the video stream and make sure it's opened
    if(!vcap.open(videoStreamAddress)) {
        std::cout << "Error opening video stream or file" << std::endl;
        return -1;
    }

    for(;;) {
        if(!vcap.read(image)) {
            std::cout << "No frame" << std::endl;
            cv::waitKey(500);
        } else {
            cv::imshow("Output Window", image);
        }
        if(cv::waitKey(1) >= 0) break;
    }
}

程序在一定时间内(大约一分钟左右)运行良好,然后对 read() 的调用(来自 cv::VideoCapture 的方法)总是返回false

输出如下:

[mpeg4 @ 00da27a0] ac-tex damaged at 22 7
[mpeg4 @ 00da27a0] Error at MB: 309
No frame
No frame
No frame

注意:前两行并不总是存在。

那么,如何确定问题的根源是什么?

4

0 回答 0