I´m trying to get a frame of a video, so I´m using MediaMetadataRetriever.getFrameAtTime() like this:
Uri directorio = Uri.parse("android.resource://com.extremeye/" + R.raw.video);
media = new MediaMetadataRetriever();
media.setDataSource(this, directorio);
frame = (ImageView)findViewById(R.id.frame);
Bitmap bmFrame = media.getFrameAtTime();
frame.setImageBitmap(bmFrame);
But the problem is that I get:
MediaMetadataRetriever getFrameAtTime: videoframe is a null pointer
in the logCat.
I´m sure that the video is compatible with android OS and the MediaMetadataRetriever loads it because I can get its metadata description without problems in a 2.3.3 OS version.
I don´t know why I can´t get the frame but if I use a 4.2 OS version, it works perfectly. I tried to change the codec and the format of the video but it doesn´t work... I suppose that it´s a problem of format compatibility but I don´t know what I can do...
Thanks!!
Actually I´m using FFmpegMediaMetadataRetriever class from this external library and works great!!
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