Categories
discuss

getFrameAtTime() returns Same Frame

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 …

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 .

Answer

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.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..