title: Why can't I open avi video in openCV?
body: <p>I just wrote a simple video reading example with openCV2.3.1, but it seems that I cannot open avi video anyway :(</p>
  
  <pre class="lang-cpp prettyprint-override"><code>VideoCapture capture("guitarplaying.avi");
  if(!capture.isOpened()){
      std::cout&lt;&lt;"cannot read video!\n";
      return -1;
  }
  Mat frame;
  namedWindow("frame");
  
  double rate = capture.get(CV_CAP_PROP_FPS);
  int delay = 1000/rate;
  
  while(true)
  {
      if(!capture.read(frame)){
          break;
      }
      imshow("frame",frame);
  
      if(waitKey(delay)&gt;=0)
          break;
  }
  
  capture.release();
  </code></pre>
  
  <p>I made a breakpoint in <code>std::cout&lt;&lt;"cannot read video!\n"</code> and find that it stopped here every time. So why avi video cannot be opened? Thanks!</p>