title: Get an error bitrate tolerance too small for bitrate when recording using opencv
body: <p>I'm new to opencv and I have a problem when writing into a video file. Basically I'm reading from a HD webcam and write to an avi. The runable codes:</p>
  
  <pre><code>#include "cv.h"
  #include "highgui.h"
  int main(int argc, char** argv){
      CvCapture* capture=NULL;
      capture=cvCreateCameraCapture(0);
      if(!capture){
              return -1; 
      }   
      IplImage *bgr_frame=cvQueryFrame(capture);
      double fps=cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
      CvSize size=cvSize((int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH),
                              (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT));        
  CvVideoWriter* writer=cvCreateVideoWriter(argv[1],
                                              CV_FOURCC('M','J','P','G'),
                                              fps,
                                              size);
      cvNamedWindow("Video", CV_WINDOW_AUTOSIZE); 
      while((bgr_frame=cvQueryFrame(capture))){
              cvWriteFrame(writer, bgr_frame);
              cvShowImage("Video", bgr_frame);
              char c=cvWaitKey(60);
              if(c==27){
                      break;
              }           
      }           
      cvReleaseVideoWriter(&amp;writer);
      cvReleaseImage(&amp;bgr_frame);
      cvReleaseCapture(&amp;capture);
      return 0;
  }
  </code></pre>
  
  <p>When running, I get an error </p>
  
  <pre><code>Output #0, avi, to 'test.avi':
  Stream #0.0: Video: mjpeg, yuvj420p, 1280x720, q=2-31, 117964 kb/s, 90k tbn
  [mjpeg @ 0x7fd55b805600] bitrate tolerance too small for bitrate
  WARNING: Could not create empty movie file container.
  OpenCV Error: Assertion failed (dst.data == dst0.data) in cvCvtColor, file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_opencv/opencv/work/OpenCV-2.3.1/modules/imgproc/src/color.cpp, line 3175
  terminate called throwing an exceptionAbort trap: 6
  </code></pre>
  
  <p>The camera is an HD webcam on a Macbook. Is that camera that causes problem? If so, can I set the bitrate tolerance lower? I'm new to opencv. Thanks!</p>
  
  <p>By the way, can the CvVideoWriter create a new file when argv[1].avi doesn't exist?</p>