title: Capture and send frames captured from video recorded by an android application to server
body: <p>I wrote an android application to capture video and stored it in the phone's file system using the Directory.DCIM and then tried to use MediaMetaDataRetriever to capture the frames but it results into IllegalStateException.</p>
  
  <p>// Snippet to capture video</p>
  
  <pre><code>File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),CAPTURE_TITLE);
          Uri outputFileUri = Uri.fromFile( file );
          Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
          intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, outputFileUri);
          startActivityForResult(intent, ACTION_TAKE_VIDEO);
  </code></pre>
  
  <p>// Snippet to capture frames </p>
  
  <pre><code>MediaMetadataRetriever retriever = new MediaMetadataRetriever();
              retriever.setDataSource(path);
              ArrayList&lt;Object&gt; al = new ArrayList&lt;Object&gt;();
              System.out.println(retriever.getFrameAtTime().toString());
              Log.d("Frame Capture", retriever.getFrameAtTime().toString());
              al.add(retriever.getFrameAtTime());
  </code></pre>
  
  <p>Is there a better way to directly capture the frames from the video being recorded and directly send it to the server without storing the video on the mobile's filesystem ? If not, how can I get the above snippet working without running into the illegal state exception. </p>