views:

655

answers:

2

file format is wmv, asx,flv, mov, rmv, rmvb, swf, mpg, mpeg. How to get thumbnail image while video uploading , if: not use ffmpeg.

A: 

Why are you ever want to avoid using something that designed especially for the task? Anyway there is a plenty of commercial and open-source tools/libraries that can help you with this, and some of them probably have API's or bindings for what you working with...

It's possible with ImageMagick using frame extraction with convert command:

convert movie.mpg[0]

You can also create animated GIF from range of frames:

convert movie.avi[0,100,200] -background white -compose darken -flatten out.gif

OR

convert movie.avi[100-200] -background white -compose darken -flatten out.gif
Juicy Scripter
A: 
Bitmap bm = MediaStore.Video.Thumbnails.getThumbnail(getContentResolver(), 1, 1, null);
ImageView iv = (ImageView) findViewById(R.id.ImageView01);
iv.setImageBitmap(bm);

/*
public static class 
MediaStore.Video.Thumbnails
public static Bitmap getThumbnail (ContentResolver cr, long origId, int kind, BitmapFactory.Options options) 
Since: API Level 5 This method checks if the thumbnails of the specified image (origId) has been created. It will be blocked until the thumbnails are generated.

Parameters
cr  ContentResolver used to dispatch queries to MediaProvider. 
origId  Original image id associated with thumbnail of interest. 
kind  The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND 
options  this is only used for MINI_KIND when decoding the Bitmap 

Returns
A Bitmap instance. It could be null if the original image associated with origId doesn't exist or memory is not enough. 
*/
Zhang Yi