2013-12-25 03:07:11 -0500 received badge ● Editor (source) 2013-12-25 02:50:08 -0500 asked a question Video playback application exits instantly Hi, I am just beginning to work with OpenCV. I am using OpenCV 2.4.7 with Qt 5.2.0 on Windows 7. As far as I can see I set up everything correctly, the code I used before (all related to "still" images, no videos) compiled and executed as intended. But now I am trying to display a video. Nothing fancy. It compiles, yet when I execute it, no video is displayed and the program exits. After adding cv::waitKey(0) to the end of the application I could only see a black window... Of course I have checked the video file itself. It is not damaged. The path is correct as well. So, why is this happening? Code and screenshot: #include #include int main() { cv::namedWindow( "Example3", cv::WINDOW_AUTOSIZE ); cv::VideoCapture cap; cap.open("vid.avi"); cv::Mat frame; while( 1 ) { cap >> frame; if( !frame.data ) break; cv::imshow( "Example3", frame ); if( cv::waitKey(33) >= 0 ) break; } cv::waitKey(0); return 0; }  Edit: So apparently the file can't be opened. I tried cap.isOpened() and the response was 'false'. But like I said before, the path is correct and the video is not damaged either...