1

I'm writing an app that captures a video from the camera of the Android device. I'm trying to get all the frames of a video without repeating frames and store them in some kind of list. By "without repeating frames", I mean this:

If I call MediaMetadataRetriever.getFrameAtTime(time, OPTION), there is a chance that two calls to this method can return the same frame if time hasn't changed much. I want to increment time enough before the next call to getFrameAtTime() such that I don't get the same frame again.

Obviously, I also want to make sure I don't miss any frames.

One way to do this is to get the frames per second of the video and increment time by the frequency of frame capture. But how would I get the frames per second of the video I captured?

Or how else would I accomplish this?

7
  • Care to explain why its off-topic? I can make appropriate changes. Commented Jul 21, 2013 at 5:25
  • Where is the camera involved? (it's not a reason to close, it's simply not clear from your description) Commented Jul 21, 2013 at 6:46
  • BTW, I believe that the 'java' tag is not relevant. Commented Jul 21, 2013 at 6:47
  • The video was captured using the Android camera. I thought it might interest those interested in camera, and they might have the know how to answer this. Java tag removed. Thanks. Commented Jul 21, 2013 at 9:04
  • why not capture frames directly from Camera? Commented Jul 21, 2013 at 13:26

1 Answer 1

1

You can register a PreviewCallback handler. This interface declares onPreviewCallback() method which is called exactly as you want: once for every distinct video frame. The parameter is the raw camera image.

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

2 Comments

Can I use this even if I'm not writing my own camera functionality? I'm just using a MediaStore.ACTION_VIDEO_CAPTURE intent to allow the user to record a video and when my activity gets back the focus, the recorded video is handed to my app through Intent data.
No, you can't. But you can launch the recorder in parallel.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.