Mediametadataretriever.Getframeattime() Returns Only First Frame

getFrameAtTime() returns Same Frame

I ran into the same problem but I could not find a solution using the MediaMetadataRetriever.

However, I did using this: https://github.com/wseemann/FFmpegMediaMetadataRetriever

Hope it helps.

NullPointerException when threading MediaMetadataRetriever [Android]

I have been able to fix the bug, but with lackluster results. The only way I have found to stop the exception from appearing is by putting a synchronize block around the MediaMetadataRetriever getFrameAtTime() function call. The new getVideoFrame method is below.

private Bitmap getVideoFrame(Uri uri, long timeInUSeconds) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(this, uri);
synchronize (this) {
Bitmap temp = retriever.getFrameAtTime(timeInUSeconds, MediaMetadataRetriever.OPTION_CLOSEST);
}
retriever.release();
return temp;
}

Sadly, as this fixes the bug, the speed concern is not aleviated, as getting the frame still takes a substantial amount of time, far more so than actually processing the frames. Nevertheless, the pr

Saving first and last frame of a video as an image on Android

You may want to take a look at the MediaMetadataRetriever class.

More specifically its getFrameAtTime(long) method.

To get the time of the last frame use getDuration(), which will return the duration of the video.

Note: This is available from API level 10!



Related Topics



Leave a reply



Submit