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
if(!capture){
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 close merge delete