It is not possible to get a video thumbnail on the Internet without fully downloading the video using the built-in API for Android, but using ffmpeg
We can extract the thumbnail from the downloaded video using the method below.
ThumbnailUtils.createVideoThumbnail (String filePath, int kind)
Where
filePath video file path
kind can be MINI_KIND or MICRO_KIND
Return value
May return null if the video is corrupt or the format is not supported.
I created a demo application for you. Please find the path to the android project which is uploaded to github AndroidFFmpeg
Run the command below to extract the first frame from the URL of the online video:
Syntax:
-itsoffset -4 -i [Url of online video] -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 [Path of image where thumbnail to be stored]
Example:
-itsoffset -4 -i http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 / sdcard / thumb.jpg
This will create a thumbnail on the SDCard with a resolution of 320x240 named thumb.jpg
source share