0

文件格式为 wmv、asx、flv、mov、rmv、rmvb、swf、mpg、mpeg。如何在视频上传时获取缩略图,如果:不使用 ffmpeg。

4

2 回答 2

2

为什么您要避免使用专门为任务设计的东西?无论如何,有很多商业和开源工具/库可以帮助你解决这个问题,其中一些可能有你使用的 API 或绑定......

ImageMagick 可以使用带有convert命令的帧提取:

convert movie.mpg[0]

您还可以从一系列帧创建动画GIF :

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

或者

convert movie.avi[100-200] -background white -compose darken -flatten out.gif
于 2009-08-14T08:09:14.153 回答
0
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. 
*/
于 2010-01-19T14:52:57.437 回答