extract frames from a video file in android
I am trying to ext开发者_JS百科ract frames from a video file in android. I have searched alot but couldn't find any clue about that. Is there any way we could do this? Could anyone please help me regarding this.
Although I'm late but,.
Use a library called - FFmpegMediaMetadataRetriever
Add this line in your build.graddle under module app:
compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
Rebuild your project.
Use the FFmpegMediaMetadataRetriever class to extract frames,. follow the steps:
FFmpegMediaMetadataRetriever med = new FFmpegMediaMetadataRetriever();
med.setDataSource("your data source");
and in your loop you can grab frame using:
Bitmap bmp = med.getFrameAtTime(i*1000000,FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
Try to use
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(videoFile, 0);
and also please visit two sites How to show image and video as thumbnail in grid view?
http://www.codeproject.com/KB/graphics/ExtractVideoFrames.aspx
精彩评论