I want to open a *.avi file and read its frames . But it didn't work . I think it's because myopencv don't support this kind of avi file. What can I do to make it capable?
VideoCapture capture("part.avi");
if(!capture.isOpened()){
cout<<"failed to read the *.avi"<<endl;
return -1;
}
double rate = capture.get(CV_CAP_PROP_FPS);
Size videoSize(capture.get(CV_CAP_PROP_FRAME_WIDTH),
capture.get(CV_CAP_PROP_FRAME_HEIGHT));
long nFrame=static_cast<long>(capture.get(CV_CAP_PROP_FRAME_COUNT));
cout<<"FPS:"<<rate<<endl;
cout<<"width:"<<videoSize.width<<" height:"<<videoSize.height<<" number of frames:"<<nFrame<<endl;
Mat frame;
namedWindow("display");
long frameToStart = 500;
capture.set(CV_CAP_PROP_POS_FRAMES,frameToStart);
capture>>frame;
if(frame.empty()) return -1;
RESULTS:
FPS:23.0769
width:1280 height:720 number of frames:42202
Program ended with exit code: 255