I`m trying to retrieve frames from video files which are captured by camera. I wrote a function to do so and i use it in a loop with different times ,receiving frames every 100000(micro sec) :
public static Bitmap getVideoFrame(long time) {
MediaMetadataRetriever mdr = new MediaMetadataRetriever();
mdr.setDataSource(path);
try {
return mdr.getFrameAtTime((time),MediaMetadataRetriever.OPTION_CLOSEST);
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
} catch (RuntimeException ex) {
ex.printStackTrace();
} finally {
try {
mdr.release();
} catch (RuntimeException ex) {
}
}
return null;
}
I know that given time must be in microseconds and i tried that.No matter what , getFrameAtTime() returns same frame all the time .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With