须要导入的三方框架: compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14' //线程 private void setBitmap(final ImageView imageView, final String path) { //设置缩略图的线程 new Thread() { @Override public void run() { super.run(); final Bitmap b = getVideoBitmap(path); if (b != null) { Log.i("xxxxx", "得到到的缩略图不为空~"); imageView.post(new Runnable() { @Override public void run() { imageView.setImageBitmap(b); } }); } else { Log.i("xxxxx", "得到到的缩略图为空~"); } } }.start(); } //BitMap获取缩略图 private Bitmap getVideoBitmap(String path) { FFmpegMediaMetadataRetriever ffmmr = new FFmpegMediaMetadataRetriever(); Bitmap bitmap = null; try { ffmmr.setDataSource(path); bitmap = ffmmr.getFrameAtTime(); if (bitmap != null) { if (bitmap.getWidth() > 400) {// 若是图片宽度规格超过640px,则进行压缩 bitmap = ThumbnailUtils.extractThumbnail(bitmap, 396, 260, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); } } } catch (IllegalArgumentException ex) { Log.i("xxxxx", ex.toString()); } finally { ffmmr.release(); } return bitmap; } }