How to Extract a Thumbnail from an FLV File

August 12, 2007

I recently had a need to extract a thumbnail graphic from an FLV file in order to use it as a placeholder graphic.

Found some help and pointers to ffmpeg and with some fiddling arrived at this:

curl -s -r 0-100000 some_url |\
ffmpeg -i - -vframes 10 -ss 00:00:00 \ 
-an -vcodec mjpeg -f rawvideo \ 
-s 180x132 -y thumb.jpg 2>/dev/null

This will read the first 1mb of some_url, pass it onto ffmpeg, grab the frame at time 00:00:00 and save it as a 180x132 jpeg file. You could also save it as a PNG by replacing mjpeg with png in the vcodec. The output size also needs to match the video ratio otherwise you get an error as well.