1
votes

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?

1
Care to explain why its off-topic? I can make appropriate changes.Cricketer
Where is the camera involved? (it's not a reason to close, it's simply not clear from your description)Alex Cohn
BTW, I believe that the 'java' tag is not relevant.Alex Cohn
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.Cricketer
why not capture frames directly from Camera?WSS

1 Answers

1
votes

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.