title: How to capture and record video from webcam using JavaCV
body: <p>I'm new to JavaCV and I have difficult time finding good tutorials about different issues on the topics that I'm interested in. I've succeed to implement some sort of real time video streaming from my webcam but the problem is that I use this code snippet which I found on the net :</p>
  
  <pre><code>@Override
      public void run() {
  
          FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next
                                                                  // camera
          int i = 0;
          try {
              grabber.start();
              IplImage img;
              while (true) {
                  img = grabber.grab();
                  if (img != null) {
                      cvFlip(img, img, 1);// l-r = 90_degrees_steps_anti_clockwise
                      cvSaveImage((i++) + "-aa.jpg", img);
                      // show image on window
                      canvas.showImage(img);
                  }
  </code></pre>
  
  <p>that results in multiple jpg files. </p>
  
  <p>What I really want to do is capture my webcam input and along with showing it I want to save it in a proper video file. I find out about <code>FFmpegFrameRecorder</code> but don't know how to implement it. Also I've been wondering what are the different options for the format of the video file, because <code>flv</code> maybe would be more useful for me.</p>