Ask Your Question

Revision history [back]

(Opencv 3.4.1)Reading video frame failed ,with error: Assertion failed (chunk.m_size <= 0xFFFF) in readFrame

I used same code and the same video and tested on the two environment.At first I tested on the "Opencv3.1.0 + windows(ubuntu) + VS2015",there is no error.But when I use the "opencv3.4.1+ MacOS + Cloin", I got the error:

  Unexpected list type. Expected: hdrl. Got: movi.
  OpenCV(3.4.1) Error: Assertion failed (chunk.m_size <= 0xFFFF) in readFrame, file /tmp/opencv-20180307-60086-ryy1b3/opencv-3.4.1/modules/videoio/src/container_avi.cpp, line 514
  libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(3.4.1) /tmp/opencv-20180307-60086-ryy1b3/opencv-3.4.1/modules/videoio/src/container_avi.cpp:514: error: (-215) chunk.m_size <= 0xFFFF in function readFrame

Test code :

VideoCapture cap("test.avi");
if(!cap.isOpened())
{
    cout << "error" << endl;
    return -1;
}
Mat img;
double rate = cap.get(CV_CAP_PROP_FPS);
cout << rate << endl;
int total_rate = cap.get(CV_CAP_PROP_FRAME_COUNT);
cout << total_rate << endl;
while (true) {
    if(!cap.read(img)) break;
}

Is there anyway to solve the problem,thanks?