( to ) ? be : ! be;
sidebar left sidebar right

Creating video thumbnails using ffmpeg (9,123 views)

Generating thumbnails/screenshots of a video is useful in many ways. Youtube and many other video sites use this to show a preview of the video as a small thumbnail. Google video captures a series of thumbnails from a video at various time intervals to show a better video preview.

There is a simple way to generate thumbnails in Linux using ffmpeg, a very very useful tool for processing videos. Let us generate a thumbnail for this video. Download the video and rename it to test.avi.

Then, run this command,

ffmpeg  -itsoffset -4  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg



This command generates a 320×240 sized PNG thumbnail at the 4th second in the video. The output looks like this.
video thumbnail

If you do not have ffmpeg installed and are using Debian/Ubuntu, do,

sudo apt-get install ffmpeg



A series of thumbnails, at 4, 8, 12 and 16 seconds.
video thumbnail
video thumbnail
video thumbnail
video thumbnail

ffmpeg  -itsoffset -4  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg  -itsoffset -8  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg  -itsoffset -12  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
ffmpeg  -itsoffset -16  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg



useful links

Happy thumbnailing!

subscribe to feed

Tags: , , ,

"Creating video thumbnails using ffmpeg" was published on March 29th, 2008 and is listed in linux, ubuntu, video.

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Comments on "Creating video thumbnails using ffmpeg": 14 Comments

  1. aris wrote,

    how if my filename is with space instead?!
    ex: my video.avi

    thanks for reply

  2. prashanthellina wrote,

    Try enclosing the filename in double quotes like this –> “my video.avi”

  3. aris wrote,

    still no effect..
    i trying to upload
    $filePath = $uploadDir.$fileName;

    ffmpeg -i “.$filePath.” -y -s 320×240 -ab 32000 -ar 22050 -g 160 -cmp 3 -subcmp 3 -mbd 2 -flags aic+cbp+mv0+mv4+trell “.$convPath

    where $filePath is source path where files is already uploaded.
    upload is successfull but when ffmpeg start to conversion i got no files at $convPath.but vice versa if i use filename with no spaces instead.

  4. prashanthellina wrote,

    The command you posted here is missing a ” at the end. When the command runs, does it throw any errors?

  5. mike wrote,

    Using “-ss” rather than “-itsoffset” is considerably faster. e.g. ffmpeg -ss 12 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320×240 test.jpg

  6. prashanthellina wrote,

    Thanks for the info, Mike.

  7. sagar wrote,

    Hi, is there any possibility to create thumbnails in windows environment

  8. prashanthellina wrote,

    Sagar, I have not tried it, but I think ffmpeg can be compiled for windows.

  9. sagar wrote,

    Thanks Prashanth Ellina…

  10. Roger wrote,

    if you canot instal ffmpeg on the server is there another option to generate thumbnails on linux

  11. jojo wrote,

    @mike , Very useful command , thanks .

  12. dong wrote,

    It is not work on Linux

  13. dong wrote,

    Help?? Please make it work on Linux

  14. Tech Musing on C&P » Blog Archive » Audio Stitching with ffmpeg wrote,

    […] Creating Video Thumbnails using FFmpeg (for -itsoffset) […]

Leave Your Comment

Subscribe without commenting

224,331 views

Prashanth Ellina is powered by WordPress

No Complaints Shifter Series Theme by Buzzdroid.com
Computers blogarama - the blog directory Blog Flux Directory Blog Directory & Search engine Computer Blogs - Blog Catalog Blog Directory Computers blogs Bloggeries Blog Directory blog directory Computers Blog Blog Search, Blog Directory p Listed in LS Blogs the Blog Directory and Blog Search Engine Blog Review Blog search - categorized blog directory Link With Us - Web Directory Find Blogs in the Blog
Directory Blog Directory