The value of i needs to be multiplied by 100000, because the method expects 
the time parameter to be in micro seconds.. hope it works...

On Monday, April 30, 2012 7:40:44 PM UTC+5, Yaron Reinharts wrote:
>
>  Hi,
>
> I'm trying to sample frames from a video.
> However, MediaMetadataRetriever.getFrameAtTime always returns the same 
> frame (the first).
>
> I tried with some emulators (2.3.3 to 4.0.3) and some video formats 
> (including mp4 and 3gp which should be supported according to 
> documentation).
>
> Here is a test code (saveBitmapToFile works well in many other locations 
> so I truest it).
>
>     MediaMetadataRetriever retriever = new MediaMetadataRetriever();
>     retriever.setDataSource(filePath);
>     String value = 
> retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
>     long length = Long.parseLong(value);
>     
>     for(int i = 0; i < length; i += 200)
>     {
>         Bitmap bitmap = retriever.getFrameAtTime(i);
>         saveBitmapToFile(bitmap, debugPath + i + ".jpg");
>     }
>
>
> What am I doing wrong?
>
> By the way, it looks that I'm not the first one bumped into this problem
>
> http://stackoverflow.com/questions/10188938/how-to-get-the-frame-from-video-file-in-android
>
> Thanks in advance
> /Yaron
>
> -- 
> Yaron Reinharts 
> Smart Drive 
> Applicationshttp://www.poncho.co.il/gateaway.phphttps://market.android.com/details?id=com.poncho.gsm.gate.activities
>
>  

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to