This is probably a task that every Flashcom developer will have to tackle at some stage: how to extract thumbnails images from an flv file, ideally automating this process with a free commandline tool such as ffmpeg.
I've had a shot at this once before, probably a year or two ago and I was somewhat successful. One key thing that I could not crack was the -ss flag in ffmpeg which allows you to seek to a position. Whenever I used that flag the jpg extraction/conversion wouldn't work, instead it returned something like 'unknown option -ss'.
But recently a user in my forum suggested to give this another try. I grabbed the ffmpeg executable from Riva Encoder and tried again - this time it worked, probably due to a newer version of ffmpeg.
For reference the syntax I used is below. This will produce an output file with the name of 1.jpg. It's also possible to add other text to the filename but ffmpeg insists to have a numbering system in there.
ffmpeg -i video.flv -an -ss 00:00:03 -an -r 1 -vframes 1 -y %d.jpg
the options are as follow: -i input file -an Disable audio recording -ss seek to (in this case second 3 to avoid black frame at start) -vframes no idea what this does, could be framerate? Anyone know? -y overwrite output file
Note: I am not sure if this will work reliably or at all with VP6 encoded files. Please post a comment if you know if it does or not.
My version of ffmpeg can be downloaded here.

#1 by phil on 4/26/06 - 2:22 AM
#2 by Carina on 5/3/06 - 1:55 PM
(just tried it and got nothing but a lot of "unsupported video codec" errors.. )
#3 by Carina Stumpf on 5/3/06 - 2:02 PM
Simply using "-r 1" usually works too but sometimes this records two frames so it's a good idea to set both -r and -vframes to 1.
#4 by Philippe Maegerman on 5/9/06 - 12:43 PM
-i pathToStream.flv -vcodec png -vframes 1 -an -f rawvideo -s 106x106 pathToImage.png
//Pim
#5 by Philippe Maegerman on 5/9/06 - 12:46 PM
ffmpeg.exe -i stream_1146848749371.flv -y -f singlejpeg -ss 0.001 -vframes 1 -an test.jpg
//Pim
#6 by Al on 10/18/06 - 1:02 PM
It looks like it is possible to use ON2 VP6 to encode FLV files :
http://sh0dan.blogspot.com/2006/09/command-line-fl...
The question is can it be done to encode all formats (qt, wmv, mpeg4, ...)
Pod
#7 by Stefan on 10/18/06 - 1:27 PM
nice though.
#8 by Podawan on 10/18/06 - 1:38 PM
BTW, here is another interesting thread :
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2...
The commercial aspect needs to be investated further.
Pod.
#9 by Matt Powell on 6/26/07 - 1:14 AM
I realize this thread is quite old, but, I thought I'd ask any ways. Is there an easy technique to grab the middle frame or atleast figure out at what time the middle of the video occurs at?
Thanks,
Matt
#10 by kvz on 9/6/07 - 3:58 PM
#11 by Hai on 11/3/07 - 4:59 PM
http://gallery.menalto.com/node/34767
#12 by Matthew on 3/26/08 - 12:55 AM
[flv @ 0040F954]Unsupported video codec (4)
[flv @ 0040F954]Unsupported video codec (4)
[flv @ 0040F954]Unsupported video codec (4)
[flv @ 0040F954]Unsupported video codec (4)
test.flv: could not find codec parameters
I typed in the following:
C:\ffmpeg>ffmpeg.exe -i test.flv -y -f singlejpeg -ss 0.001 -vframes 1 -an test.
jpg
Does anyone know what I am doing wrong?
#13 by Morris Jones on 5/22/08 - 7:16 PM
#14 by Julien on 6/12/08 - 10:16 AM
- download ffmpeg source
- download 'all' codec from mplayer site
- install codec in /usr/lib/codecs
- compile ffmpeg
You should now have an VP6 support
#15 by WebTenet Solutions on 7/18/08 - 12:32 PM
#16 by Nick on 9/1/08 - 5:38 AM
With the latest release (ffmpeg.rev12665.7z) I'm successfully producing PNG's from FLV's that use the VP6F codec.
Thank you to Julien and Stefan, as without either of you I'd have never found this solution.
#17 by harjot singh chopra on 11/21/08 - 9:04 AM
#18 by Navraj on 12/12/08 - 8:36 AM
#19 by Salman on 3/4/09 - 4:13 PM
It's urgent.
Regards,
Salman Ghouri
#20 by OverSoft on 4/17/09 - 4:03 PM
If you get an echo with all sorts of ffmpeg information, then you have it.
If you don't have shell access, try it with a simple PHP script:
<?php echo shell_exec("ffmpeg 2>&1"); ?>
You'll get the same info as you would get via shell access.
#21 by avinash on 7/22/09 - 12:31 PM
#22 by avinash on 7/22/09 - 1:34 PM
#23 by kim on 2/7/10 - 10:46 PM
im using a command like:
ffmpeg -ss 00:20:00 -i UGM001_Bobby-Nasha.ogv -r 1 -vframes 1 -s 128x72 -f image2 UGM%03d.jpeg
where -ss is the starting seek position.
This works fine, but only when im lucky enough to hit a keyframe! otherwise ffmpeg gives an error: "first frame is not a keyframe"..
Since the location of keyframes will vary according to whatever the encoder deems is optimal, is there any way to tell ffmpeg to grab from the next available keyframe?
thanks
#24 by Caue Rego on 4/9/10 - 11:34 PM
@kim I'd guess you have that message due to the encoder. I don't have enough experience to tell for sure, but try another file or encoding option and see if that message still happens. You could also try not using the -vframes:
fmpeg -ss 00:20:00 -i UGM001_Bobby-Nasha.ogv -r 1 -t 1 -s 128x72 -f image2 UGM%03d.jpeg
This should give you the same effect in this case, since "-t 1" will get you only the first second, and "-r 1" will get you only 1 frame per each second. But since it's not "the first next frame", if there's enough keyframes there (at least one per second) it should surpass the error.
You could also try to just drop the "-r 1" and use only the "-vframes 1" which might bring "the first next keyframe", since it's what is attempting already, but maybe it can't find it due to the limiting "-r 1" to 1 frame from each second.
#25 by Steve on 7/28/10 - 2:57 PM
#26 by totaaa on 5/7/11 - 1:47 PM
I tried to create thumbnail from .flv
but i have this error
[flv @ 0040F954]Unsupported video codec (7)
[flv @ 0040F954]Unsupported video codec (7)
[flv @ 0040F954]Unsupported video codec (7)
[flv @ 0040F954]Unsupported video codec (7)
[flv @ 0040F954]Unsupported video codec (7)
Seems that stream 0 comes from film source: 1000.00 (1000/1) -> 30.00 (30/1)
Input #0, flv, from 'test.flv':
Duration: N/A, bitrate: N/A
Stream #0.0: Video:
Stream #0.1: Audio: 0x000a, 44100 Hz, stereo
Output #0, rawvideo, to 'pathToImage.png':
Stream #0.0: Video: png, 106x106, 30.00 fps, q=2-31, 200 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec (id=0) for input stream #0.0
can anyone help me?
#27 by roger on 6/7/11 - 9:28 PM
#28 by muskurahat on 6/13/11 - 9:58 AM
help me
#29 by Hindi Songs on 6/13/11 - 10:00 AM