I have to write a program where all the videos store in my device to be shown with thumbnails.
i am able to list them all but most of them are coming with black thumbnail while in gallery application those shows perfectly.
please help me!
what i have tried is
MediaStore.Video.Thumbnails.getThumbnail(mContex.getContentResolver(), id, MediaStore.Video.Thumbnails.MICRO_KIND, null);
or
ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MICRO_KIND)
Some video files (e.g. mp4s that can be downloaded from YouTube) have few black frames in the beginning, and this is what you will see with
ThumbnailUtils.createVideoThumbnail().You can use MediaMetadataRetriever class to extract frames from the file at some offset from time=0. To get the best results you, should use getFrameAtTime(t, OPTION_NEXT_SYNC) and iterate through time t to find a non-trivial thumbnail. You can try the steps of 500000 (half second).