title: Using OpenCV 2.4.4 with FFmpeg in Windows
body: <p>I know there are other questions dealing with FFmpeg usage in OpenCV, but most of them appear to be outdated.</p>
  
  <p>By opening up the makefiles in CMake, I can verify that I've got the <code>WITH_FFMPEG</code> flag on. My output folder for the OpenCV build contains a <code>bin</code> folder, within which are <code>Debug</code> and <code>Release</code> folders, each containing a copy of a .dll file entitled <code>opencv_ffmpeg244.dll</code>. I can step into the source code of OpenCV when I create a VideoWriter and verify that the function pointers to the .dll get filled correctly. That much appears to be working.</p>
  
  <p>If I use the FOURCC code of CV_FOURCC_PROMPT, the following codecs <strong>work properly</strong>:</p>
  
  <ul>
  <li>Microsoft Video 1</li>
  <li>Intel IYUV codec</li>
  <li>Logitech Video (I420)</li>
  <li>Cinepak Codec by Radius</li>
  <li>Full Frames (Uncompressed)</li>
  </ul>
  
  <p>The following codecs <strong>do not work properly</strong> (ie. produce a 0kb video file):</p>
  
  <ul>
  <li>Microsoft RLE</li>
  </ul>
  
  <p>If my understanding is correct, using FFMPEG should allow for encoding video using a whole bunch of new codecs (x264, DIVX, XVID, and so on). However, none of these appear in the prompt. Manually setting them by their FOURCC codes using the macro <code>CV_FOURCC(...)</code> also doesn't work. For instance, using this: <code>CV_FOURCC('X','2','6','4')</code> produces the message:</p>
  
  <p><code>Could not find encoder for codec id 28: Encoder not found</code></p>
  
  <p>and makes a video file of size 0kb.</p>
  
  <p>Using this: <code>CV_FOURCC('X','V','I','D')</code> produces no error message, and makes a video file of 6kb that will not play in Windows Media Player or VLC.</p>
  
  <p>I tried manually downloaded the Xvid codec from Xvid.org. Once that was installed, it appeared under the VFW selection in the prompt, and the encoding worked properly. So it's close to a solution, but if I try to set the FOURCC code directly, it still fails as above! I have to pick it from the prompt every time. Isn't FFmpeg supposed to include a whole bunch of codecs? If so, why am I manually downloading the codec instead of using the one built into FFmpeg?</p>
  
  <p>What am I missing here? Is there a way to check that FFMPEG is "enabled"? It seems like the only codecs available in the prompt are VFW codecs, not the FFMPEG ones. The <code>.dll</code> has been built and is sitting in the same folder as the executable, but it appears it's not being used in any way. </p>
  
  <p>Lots of related questions here. Hoping to find somebody knowledgeable about the FFmpeg implementation in OpenCV and with some knowledge of how all of these pieces fit together.</p>