title: Can't open a mpg-File for capture using EmguCV with C#
body: <p>I'm trying to open a mpg-File using emguCV. I use the following code:</p>
  
  <pre><code>    if (instance == null)
      {
          lock (m_lock)
          {
              try
              {
                  instance = new Capture(0);  // capture from camera works fine if a camera is connected
              }
              catch (NullReferenceException)
              {
                  String sFileName = @"C:\tmp\MarkerMovie.mpg";
  
  
                  try
                  {
                      if (File.Exists(sFileName))
                      {
                          instance = new Capture(sFileName);  // here the exception is thrown
                      }
                      else
                      {
                          MessageBox.Show("No Camera and no Video-File found");
                      }
                  }
                  catch (NullReferenceException)
                  {
                      MessageBox.Show("Couldn't open Video: "+sFileName);
                  }
              }
          }
      }
  </code></pre>
  
  <p>If a webcam is connected everything works fine, but when I unplug the webcam the line <code>instance = new Capture(sFileName);</code> throws a NullReferenceException:</p>
  
  <blockquote>
    <p>Message = "Unable to create capture from C:\tmp\MarkerMovie.mpg"</p>
  </blockquote>
  
  <p>I debugged and found the reason is in the constructor of capture. The following command always returns a Null-Pointer:</p>
  
  <pre><code>_ptr = CvInvoke.cvCreateFileCapture(fileName);
  </code></pre>
  
  <p>I could open the same video using C++ using this code:</p>
  
  <pre><code>cap = cvCaptureFromFile("C:\\tmp\\MarkerMovie.mpg");
  </code></pre>
  
  <p>I'm new to openCV, so I'm not sure which information you need to help me. I installed emguCV yesterday from <a href="http://sourceforge.net/projects/emgucv/" rel="nofollow">http://sourceforge.net/projects/emgucv/</a> on a Windows XP computer. The installer-version is x86_2.3.0.1416. I included opencv_core231.dll, opencv_highgui231.dll and opencv_imgproc231.dll to my project.</p>
  
  <p>Does somebody know how I can make this code working?
  Let me know if you need more information.</p>
  
  <p>Thanks.</p>