title: MediaMetadataRetriever.getFrameAtTime() returns only first frame
body: <p>I have extracted frames from a video using MetadataRetriever, and have stored all images in an <code>ArrayList&lt;Bitmap&gt;</code>. I want to store all of them on an SD card (just for testing purposes).</p>
  
  <p>But when I pull out a folder from the emulator and look at the saved images, all images were of the video's first frame only.</p>
  
  <p>This is how I extract the frames from the video:</p>
  
  <pre><code>File videoFile=new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/videos","sample_mpeg4.mp4");
  
  Uri videoFileUri=Uri.parse(videoFile.toString());
  
  MediaMetadataRetriever retriever = new MediaMetadataRetriever();
  retriever.setDataSource(videoFile.getAbsolutePath());
  ArrayList&lt;Bitmap&gt; rev=new ArrayList&lt;Bitmap&gt;();
  
  //Create a new Media Player
  MediaPlayer mp = MediaPlayer.create(getBaseContext(), videoFileUri);
  
  int millis = mp.getDuration();
  for(int i=0;i&lt;millis;i+=100){
     Bitmap bitmap=retriever.getFrameAtTime(i,OPTION_CLOSEST_SYNC);
     rev.add(bitmap);
  }
  </code></pre>
  
  <p>And this is how I'm saving them (I'm calling this method and passing the bitmap ArrayList):</p>
  
  <pre><code>public void saveFrames(ArrayList&lt;Bitmap&gt; saveBitmapList) throws IOException{
      Random r = new Random();
      int folder_id = r.nextInt(1000) + 1;
  
      String folder = Environment.getExternalStorageDirectory()+"/videos/frames/"+folder_id+"/";
      File saveFolder=new File(folder);
      if(!saveFolder.exists()){
         saveFolder.mkdirs();
      }
  
      int i=1;
      for (Bitmap b : saveBitmapList){
         ByteArrayOutputStream bytes = new ByteArrayOutputStream();
          b.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
  
          File f = new File(saveFolder,("frame"+i+".jpg"));
  
          f.createNewFile();
  
          FileOutputStream fo = new FileOutputStream(f);
          fo.write(bytes.toByteArray());
  
             fo.flush();
             fo.close();
  
          i++;
      }
      Toast.makeText(getApplicationContext(),"Folder id : "+folder_id, Toast.LENGTH_LONG).show();
  
  }
  </code></pre>
  
  <p>When I pull out a folder to see all frames, all of the images were of the first frame of video. Can someone please explain to me what is happening?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I've tried with another video. I've found that I'm not getting blank images, but it's always returning the first frame only.</p>
  
  <p><code>MediaMetadataRetriever.getFrameAtTime(long timeUS)</code> is returning only the first frame, but I want to retrieve all frames. What changes should I make?</p>
  
  <p>How do I tackle this?</p>