0

I want to extract frames from video file stored on the device. Every solution i found is to use FFmpegMediaMetadataRetriever or MediaMetadaraRetriever, but as I wrote here it's not working for me. Is there any other way to extract frames from video?

1 Answer 1

1

I admit I haven't used this method for a while, but if it still works with the current Android API, it should do the trick.

Please let me know if it still works. If not - I will delete this answer.

public static Bitmap getVideoFrame(Context context, Uri uri, long time) { Bitmap bitmap = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setDataSource(context, uri); bitmap = retriever.getFrameAtTime(time); } catch (RuntimeException ex) { ex.printStackTrace(); } finally { try { retriever.release(); } catch (RuntimeException ex) { ex.printStackTrace(); } } return bitmap; } 

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

It's not working for me, but it works when I use setDataSource(context, Uri) instead of setDataSource(path).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.