How can I create a thumbnail from a photo or a video with the standard OS X tools? I mean, Finder is able to do it, so (being a Linux user), I expect to be able to do exactly the same without the GUI; is it possible?
It's far from perfect however you can use the save the thumbnail that Quick Look generates in the Finder by running the following command:
qlmanage -ti /PATH/TO/VIDEO_FILE.ext -o /PATH/TO/SAVE/PNG/TO
By default this produces a 128x128 png. Removing the
i in the
-ti will give you a PNG with the same aspect ratio as the video with the longest side being 128px.
To make it larger add the
-s option or the
#512px version of the Finder icon qlmanage -ti /PATH/TO/VIDEO_FILE.ext -s 512 -o /PATH/TO/SAVE/PNG/TO #2.0 scaled version aka 256px qlmanage -ti /PATH/TO/VIDEO_FILE.ext - 2.0 -o /PATH/TO/SAVE/PNG/TO
If you want better results (eg. choose your frame) I recommend using MacPorts to install ffmpeg or ImageMagick. (See fideli's answer)
To expand on www.haykranen.nl's post, install ffmpeg and ImageMagick using MacPorts.
For pictures, create a thumbnail using (i.e. fits within 250x90):
convert -thumbnail 250x90 in.png out.png
More info here.
For movies, create a thumbnail using:
ffmpeg -ss 00:09:00 in.avi -vcodec png -vframes 1 -an \ -f rawvideo -s 119x64 out.png
ffmpeg -ss 00:09:00 in.avi -vcodec mjpeg -vframes 1 -an \ -f rawvideo -s 119x64 out.jpg
-ss 00:09:00 represents the point you want to take the thumbnail from (i.e. starting time),
-vcodec represented here for either a PNG or JPEG, and
-s is for the final size of the thumbnail. More info here.
Unfortunately, these tools aren't standard OS X tools. Your suggestion about how Finder is able to do it likely happens through a QuickTime or CoreVideo method that isn't easily accessible at the command line.