srikanth
srikanth

Reputation: 239

extract frames from a video file in android

I am trying to extract 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.

Upvotes: 3

Views: 6962

Answers (2)

Maniraj
Maniraj

Reputation: 155

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);

Upvotes: 1

Balban
Balban

Reputation: 736

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

Upvotes: 0

Related Questions