title: opcv videowriter, i don't know why it does'nt work
body: <p>I've just written a first program for videocaptur and videowriter. I copied the source from the wiki and changed the only video file name, but it made error. </p>
  
  <p>Here is the source from the wiki.</p>
  
  <p>The opencv is 2.1 and the compiler is visual c++ 2008 express.</p>
  
  <pre><code>#include "cv.h"
  #include "highgui.h"
  
  using namespace cv;
  
  int main(int, char**)
  
  {
  
          VideoCapture capture(1); // open the default camera
  
          if( !capture.isOpened() )  {
  
                  printf("Camera failed to open!\n");
  
                  return -1;
          }
  
          Mat frame;
  
          capture &gt;&gt; frame; // get first frame for size
  
          // record video
  
          VideoWriter record("RobotVideo.avi", CV_FOURCC('D','I','V','X'), 30, frame.size(), true);
  
          if( !record.isOpened() ) {
  
                  printf("VideoWriter failed to open!\n");
  
                  return -1;
  
          }
  
          namedWindow("video",1);
  
          for(;;)
  
          {
                  // get a new frame from camera
  
                  capture &gt;&gt; frame; 
  
                  // show frame on screen
  
                  imshow("video", frame); 
  
                  // add frame to recorded video
  
                  record &lt;&lt; frame; 
  
                  if(waitKey(30) &gt;= 0) break;
  
          }
  
          // the camera will be deinitialized automatically in VideoCapture destructor
          // the recorded video will be closed automatically in the VideoWriter destructor
  
          return 0;
  }
  </code></pre>
  
  <p>With the source, I changed 2 parts. One is for VideoCapture. (I don't have tunercard or camera.) The source is</p>
  
  <pre><code>    VideoCapture capture(1); // open the default camera
  </code></pre>
  
  <p>and changed to</p>
  
  <pre><code> VideoCapture capture("C:/Users/Public/Videos/Sample Videos/WildlifeTest.wmv"); 
  </code></pre>
  
  <p>And the other is for VideoWriter:</p>
  
  <pre><code>   // record video
  
      VideoWriter record("RobotVideo.avi", CV_FOURCC('D','I','V','X'), 30, frame.size(), true);
  </code></pre>
  
  <p>and changed to</p>
  
  <pre><code>  VideoWriter record("C:/Users/Public/Videos/Sample Videos/WildlifeRec.wmv",
                        CV_FOURCC('W','M','V','1'), 30,frame.size(), true);
  </code></pre>
  
  <p>and the part of error is:</p>
  
  <pre><code>        // add frame to recorded video
  
          record &lt;&lt; frame; 
  </code></pre>
  
  <p>Please show me what is my mistake! </p>
  
  <p>P.S. 
  when I delete the line <code>record &lt;&lt; frame;</code>, it works well. I think the error caused at the line.</p>
  
  <p>And I found that even if without change, the wiki source program make same error.</p>