Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaMetadataRetriever getFrameAtTime: videoframe is a null pointer

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!!

like image 704
Gonzalo Solera Avatar asked Nov 02 '22 18:11

Gonzalo Solera


1 Answers

Actually I´m using FFmpegMediaMetadataRetriever class from this external library and works great!!

like image 157
Gonzalo Solera Avatar answered Nov 08 '22 04:11

Gonzalo Solera