Making thumbnails for movies with ffmpeg

I am slowly publishing our movie clips to my gallery. Gallery software has an excellent ffmpeg plugin that automatically creates thumbnails for movies so that it is very easy to see what is what. The only shortcoming it has is that it is not possible pick the frame from the clip for the thumbnail. It always takes the first one. Or maybe I just haven’t found out how to work aorund it.

Anyway, the good thing is that Gallery also allows to use custom thumbnails for albums and files. This comes very handy when the clip that you’ve posted starts with a second or two of black screne. Or some other non-sense. All you have to do than is running the following command:

[me@here dir]$ ffmpeg -y -i someclip.avi  \
[me@here dir]> -f singlejpeg -ss 10 -vframes 1 \
[me@here dir]> -s 150x100 -an thumb.jpg

Obviously you’d want to change a few things here. someclip.avi should be the name of you movie clip file that ffmpeg will be processing. thumb.jpg is the name of the file to save the thumbnail in. 10 nearby the -ss option tells ffmpeg how many seconds from the start of the clip you want to skip. If you want to skip a few minutes or hours, or specify a split second, then check ffmpeg manual for the syntax. And the last option that should be interesting for you is the -s which in my example has the value of 150×100 – the size of the image in pixels (X,Y).

21 thoughts on “Making thumbnails for movies with ffmpeg”


  1. Thanks for documenting this, Leonid!

    FYI, for others who google their way to this blog entry, in the latest version (as of 2005/10/21), you need to use “mjpeg” instead of “singlejpeg”. The developers removed singlejpeg because apparently it worked identically to mjpeg.

    If you don’t make the change, you’ll end up with the following error message:

    Unknown input or output format: singlejpeg


  2. Thanks, Leonid

    I’ve been looking for this tutorial for quite a while. I’m still curious about making thumbnails out of SWF files (not flv), but I don’t think its possible


  3. Alex,

    The -vframes parameter sets the number of video frames to record. In the case of thumbnail you only need one frame, hence the value.

    I’ve checked the manual and this option is not there indeed. I found the description but running ffmpeg without any parameters.

    HTH.


  4. hi do you know a way to extract a frame to process using libavformat, libavcodec. and distingish between I P B frames. i wil be a happy person if you help me..


  5. If you get “Incorrect frame size” it’s because this web page has weird encoding making the x in “-s 150×100” a special character rather than a regular x.

Leave a Comment