title: Extract bitmap from video in android
body: <p>I am trying to extract all frames from a video.<br>
  By following code I want to fetch the first 30 frames of a video, but I got only first frame 30 times. </p>
  
  <pre><code>private ArrayList&lt;Bitmap&gt; getFrames(String path) {
      try {
          ArrayList&lt;Bitmap&gt; bArray = new ArrayList&lt;Bitmap&gt;();
          bArray.clear();
          MediaMetadataRetriever mRetriever = new MediaMetadataRetriever();
          mRetriever.setDataSource("/sdcard/myvideo.mp4");                    
  
          for (int i = 0; i &lt; 30; i++) {
              bArray.add(mRetriever.getFrameAtTime(1000*i, 
                         MediaMetadataRetriever.OPTION_CLOSEST_SYNC));
          }
          return bArray;
      } catch (Exception e) { return null; }
  }
  </code></pre>
  
  <p>Now, how can I get all frames from a video?</p>