title: How to grab video frames from onPreviewFrame in android?
body: <p>In my application I am using surfaceiew to take video in android. In onpreviewFrame method I have written code to grab frames, but problem is I can not get all frames of video. I am capturing around 14 second video, but I get only around 90 frames. frame rate is 30 fps and image size is 800 x 480.</p>
  
  <p>The code is below to frab frames in onPreviewFrame method:</p>
  
  <pre><code>formattedFileCount = fileCountFormatter.format(fileCount);
  jpegFile = new File(Environment
                          .getExternalStorageDirectory().getPath()
                          + "/abc/foo-"
                          + formattedFileCount + ".jpg");
                  fileCount++;
  
  Camera.Parameters parameters = camera.getParameters();
  Size size = parameters.getPreviewSize();
  YuvImage image = new YuvImage(b,
                  parameters.getPreviewFormat(), 800,
                  480, null);
  
  
  fos = new FileOutputStream(jpegFile);
  bos = new BufferedOutputStream(fos);
  image.compressToJpeg(
          new Rect(0, 0, image.getWidth(), image.getHeight()),
              90, bos);
  </code></pre>
  
  <p>So for around 14 second video, total frames would be 420, but i just get less than 100 frames. Any solutions for that?</p>