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).
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
Thanks Erin.
Cool, Was looking for this for awhile now, thanks
Thanks! I’ve been looking for this. And thanks google!
You’re welcome John ;)
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
I don’t know of a way to make thumbnails from SWF files. Sorry.
What does the -vframes refer to? I didn’t even see it on the offical ffmpeg documentation.
Alex
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.
So making thumbs directly from swf is possible ! But in this case you have to make action-script which does it. Try searching at google.
Blaster,
Of course, it is possible – it’s just software. :)
thanks
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..
suhail,
sorry to disappoint you, but it was more than 2 years ago, since I worked with this stuff. Even if I knew back then, I have long forgotten.
ny how thanks leonid..
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.
So true. Even my text editor screwed me on this one!
Great thanks to the author and great thanks to Erin Mulder! Works perfect!