List of utility methods to do Video Thumbnail Create
Bitmap | createVideoThumbnail(String filePath) create Video Thumbnail Class<?> clazz = null; Object instance = null; try { clazz = Class.forName("android.media.MediaMetadataRetriever"); instance = clazz.newInstance(); Method method = clazz.getMethod("setDataSource", String.class); method.invoke(instance, filePath); if (Build.VERSION.SDK_INT <= 9) { ... |
Bitmap | getVideoThumbnail(String videoPath, int width, int height, int kind) get Video Thumbnail try { Bitmap bitmap = null; bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind); System.out.println("w" + bitmap.getWidth()); System.out.println("h" + bitmap.getHeight()); bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; ... |
Bitmap | getVideoThumbnail(String videoPath, int width, int height, int kind) get Video Thumbnail Bitmap bitmap = null; bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind); System.out.println("w" + bitmap.getWidth()); System.out.println("h" + bitmap.getHeight()); bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; |
Bitmap | createVideoThumbnail(String imagePath, int kind) Create a video thumbnail for a video. Bitmap bitmap = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); retriever.setDataSource(filePath); bitmap = retriever.captureFrame(); } catch (IllegalArgumentException ex) { } catch (RuntimeException ex) { ... |
Bitmap | createVideoThumbnail(String filePath, int size) create Video Thumbnail Bitmap bitmap = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setDataSource(filePath); bitmap = retriever.getFrameAtTime(-1); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } catch (RuntimeException ex) { ... |