title: Cannot open videos in Opencv
body: <p>I am trying to open .avi file in opencv. When I run the code I do not get any error but the video does not play. I searched around and I guess it requires ffmpeg to be installed. So I installed it using
      sudo apt-get install libavformat-dev libavcodec-dev libavfilter-dev libswscale-dev 
  It still does not work. Maybe the compiler needs to know where to find ffmpeg. I am using gcc compiler.
  Thanks. </p>
  
  <p>@Paul R: I have just copied the code from the Learning Opencv textbook, so wasn't including it. The code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;highgui.h&gt;
  int main( int argc, char** argv ) {
  cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE );
  CvCapture* capture = cvCreateFileCapture( argv[1] );
  IplImage* frame;
  while(1) {
      printf("Inside");
      frame = cvQueryFrame( capture );
      if( !frame ) break;
      cvShowImage( "Example2", frame );
      char c = cvWaitKey(33);
      if( c == 27 ) break;
  }
  cvReleaseCapture( &amp;capture );
  cvDestroyWindow( "Example2" );
  </code></pre>
  
  <p>}</p>
  
  <p>@praks411: </p>
  
  <pre><code>printf("%s",argv[1]);
  CvCapture* capture = cvCreateFileCapture( argv[1] );
  if(!capture)
  {   
          printf("failed\n");
      return -1; 
  }
  </code></pre>
  
  <p>It prints the argument correctly and the capture fails.</p>