title: ArgumentException was unhandled; Value does not fall within the expected range
body: <p>I am trying to select and play a video file and detect face using "haar cascade". When i select a video file it shows exception "ArgumentException was unhandled" in this line<br>
  <strong>int len = (int)memde.StreamLength;</strong><br>
  This is the code I used: </p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          OpenFileDialog openFileDialog1 = new OpenFileDialog();
          if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
          {
                  memde = new MediaDetClass();
                  System.IO.Directory.CreateDirectory("temp");
                  int len = (int)memde.StreamLength;
                  label1.Text = "Length: " + len.ToString();
                  trackBar1.Minimum = 0;
                  trackBar1.Maximum = len;
                  trackBar1.Value = 0;
                  counter = 0;
                  Image img;
                  memde.Filename = openFileDialog1.FileName;
                  memde.CurrentStream = 0;
                  float percent = 0.002f;
                  Image&lt;Gray, byte&gt; gray;
                  for (float i = 0.0f; i &lt; len; i = i + (float)(percent * len))
                  {
                      counter++;
                      string fbitname = storagepath + counter.ToString();
                      memde.WriteBitmapBits(i, 850, 480, fbitname + ".bmp");
                      pictureBox1.Image = new Bitmap(fbitname);
                      img = Image.FromFile(fbitname + ".bmp");
                      img.Save(fbitname + ".bmp", ImageFormat.Bmp);
                      System.IO.File.Delete(i + fbitname + ".bmp");
                      Image&lt;Bgr, Byte&gt; image = new Image&lt;Bgr, Byte&gt;(new Bitmap(img));
                      gray = image.Convert&lt;Gray, Byte&gt;();
                      MCvAvgComp[][] facesDetected = gray.DetectHaarCascade(
                   face,
                   1.2,
                   10,
                   Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
                   new Size(20, 20));
                      foreach (MCvAvgComp f in facesDetected[0])
                      {
                          result = image.Copy(f.rect).Convert&lt;Gray, byte&gt;().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC);
                          image.Draw(f.rect, new Bgr(Color.Red), 2);
                      }
                  }
          }
      }
  </code></pre>