I am trying to extract all frames from a video.
Following the code, I want to get the first 30 frames of the video, but I only got the first frame 30 times.
private ArrayList<Bitmap> getFrames(String path) { try { ArrayList<Bitmap> bArray = new ArrayList<Bitmap>(); bArray.clear(); MediaMetadataRetriever mRetriever = new MediaMetadataRetriever(); mRetriever.setDataSource("/sdcard/myvideo.mp4"); for (int i = 0; i < 30; i++) { bArray.add(mRetriever.getFrameAtTime(1000*i, MediaMetadataRetriever.OPTION_CLOSEST_SYNC)); } return bArray; } catch (Exception e) { return null; } }
Now, how can I get all the frames from the video?
android video bitmap media
krishna kant gupta
source share