cvcapturefromavi not loading anything

asked 2014-03-17 10:06:45 -0500

Irene gravatar image

updated 2014-03-17 10:40:46 -0500

Hello, I'm trying to get frames from video (avi-file). I'm under Windows,32bit, QT 5.2.0(Mingw-compiler), OpenCV 2.4.8. It's really a simple thing, i must be really dumb, but I can't get it. Here's the code:

CvCapture *capture = NULL;
capture = cvCaptureFromAVI("road4n.avi");//this file in the build folder
    return -1;
}//more code here, but it doesn't work...

The program finishes with the code -1. When I remove the if condition, no errors occur, but the rest dosen't perform anyway. I've tried different paths, like "C:/road4n.avi", writing the full path to the build directory, using like all sorts of slashes etc with no result at all. I've also tried cvCaptureFromFile but it dosen't work either, but cvCaptureFromCAM(0) works fine. At some places they say that the recompilation of the opencv might solve the problem, but maybe it's easier than that? Thank you in advance!

UPD: I've edited the code so that no old-fashioned functions are used, so now it's:

VideoCapture cap("road4n.avi");
if(!cap.isOpened()) // check if we succeeded
return -1;

Result's still the same:(

edit retag flag offensive close merge delete


it won't solve your problem, but please use the c++ api (cv::VideoCapture) , not the outdated c one

berak gravatar imageberak ( 2014-03-17 10:13:47 -0500 )edit