title: VideoCapture OpenCV 2.4.2 error in windows
body: <p>I have a problem using VideoCapture class with OpenCV 2.4.2 under windows XP 32bits.
  It doesn't open any file or camera and fixing it's being a pain.
  Im using visual studio 2010 but i have also tried the code in QTcreator with the same result.</p>
  
  <p>The testing code is the following: </p>
  
  <pre><code>#include "opencv/cv.h"
  #include "opencv/highgui.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt; 
  #include &lt;iomanip&gt; 
  #include &lt;sstream&gt; 
  
  using namespace cv;
  using namespace std;
  
  int main()
  {
      const char* videoPath = "C:/video/";
      string videoName = string(videoPath) + "avi.avi";
      VideoCapture cap(videoName);
  
      if(!cap.isOpened()) 
      {
          std::cout&lt;&lt;"Fail"&lt;&lt;std::endl;
          return -3;
      }
      return 0; 
  }
  </code></pre>
  
  <p>The output is always '-3'.
  Qt Creator shows a 
      warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:361)</p>
  
  <p>I debugged it and the problem appears in the first line of:</p>
  
  <pre><code>CvCapture* cvCreateFileCapture_FFMPEG_proxy(const char * filename)
  {
      CvCapture_FFMPEG_proxy* result = new CvCapture_FFMPEG_proxy;
      if( result-&gt;open( filename ))
          return result;
      delete result;
  #if defined WIN32 || defined _WIN32
      return cvCreateFileCapture_VFW(filename);
  #else
      return 0;
  #endif
  }
  </code></pre>
  
  <p>in the cap_ffmpeg.cpp internal file.</p>
  
  <p>I have tested the same code in a mac under snow leopard and it works. No surprises here since it must be a library issue.
  I have opened the avi file with the same path route using the c-function cvCapture easy and fast.
  I got all the dlls of 'C:\opencv\opencv\build\x86\vc10\bin'
  included in mi debug file. I got the tbb.dll and all the 'C:\opencv\opencv\3rdparty\ffmpeg' content included too.</p>
  
  <p>This is drving me crazy so any help would be appreciated.</p>
  
  <p>Thanks in advance.</p>