文件格式为wmv,asx,flv,mov,rmv,rmvb,swf,mpg,mpeg。 如何在视频上传时获取缩略图,如果:不使用ffmpeg。
答案 0 :(得分:1)
为什么你想避免使用专门为这项任务设计的东西?无论如何,有很多商业和开源工具/库可以帮助你解决这个问题,其中一些可能有API或绑定你的工作......
ImageMagick可以使用convert
命令进行帧提取:
convert movie.mpg[0]
您还可以从一系列帧中创建动画 GIF :
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
答案 1 :(得分: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.
*/