FlashComGuru Home Imediasee Influxis Uvault Akamai
                                                                                       Forum Index | Active Topics | Register
                                                                                                          List Overview | List Archives
                                                                                                                           About this site | Advertise
 

home

Adobe AIR (8)
Applications (33)
Books & Training (9)
Collaboration (10)
Components (6)
Events (56)
Flash Player (11)
Flex (31)
FMS (78)
General (113)
Hosting (5)
Jobs (13)
Off topic (33)
Press Releases (13)
Site Check (9)
Tools (43)
Videos & Players (57)

Follow me on Twitter

Alltop, all the cool kids (and me)

 
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.

Comments
[Add Comment]
very nice.
# Posted By phil | 4/26/06 2:22 AM
As far as I know ffmpeg does not support VP6 and will not support it in the near future (as it is a proprietary codec).

(just tried it and got nothing but a lot of "unsupported video codec" errors.. )
# Posted By Carina | 5/3/06 1:55 PM
Ah, I forgot: -r sets frame rate, I've never used -vframes but google tells me it "sets the number of video frames to record".

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.
# Posted By Carina Stumpf | 5/3/06 2:02 PM
I got it working for .png export:

-i pathToStream.flv -vcodec png -vframes 1 -an -f rawvideo -s 106x106 pathToImage.png

//Pim
# Posted By Philippe Maegerman | 5/9/06 12:43 PM
Btw, I have some code for jpeg export that is slightly different than yours, and working too :)

ffmpeg.exe -i stream_1146848749371.flv -y -f singlejpeg -ss 0.001 -vframes 1 -an test.jpg

//Pim
# Posted By Philippe Maegerman | 5/9/06 12:46 PM
Hi,

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
# Posted By Al | 10/18/06 1:02 PM
very cool, thanks for posting this. It still seems quite a lot of work though don't you think? It would be a different story if AviSynth wasn't required on top of ffmpeg. I'm also not sure about the legality if you would indeed use this commercially.

nice though.
# Posted By Stefan | 10/18/06 1:27 PM
Yes, AviSynth is needed in this case.

BTW, here is another interesting thread :
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2...

The commercial aspect needs to be investated further.

Pod.
# Posted By Podawan | 10/18/06 1:38 PM
Hi All,

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
# Posted By Matt Powell | 6/26/07 1:14 AM
An <a href="http://kevin.vanzonneveld.net/techblog/article/cre...">ffmpeg flv tutorial</a> for beginners
# Posted By kvz | 9/6/07 3:58 PM
The singlejpeg codec has been deprecated, now to extract jpeg thumbnail use mjpeg instead:
http://gallery.menalto.com/node/34767
# Posted By Hai | 11/3/07 4:59 PM
I am getting the following error:

[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?
# Posted By Matthew | 3/26/08 12:55 AM
If you add "-f image2" to the parameter list, you don't have to put %d in the output filename.
# Posted By Morris Jones | 5/22/08 7:16 PM
In order to correct the 'Unsupported video codec' error you have to recompile ffmpeg with binary codec installed :

- download ffmpeg source
- download 'all' codec from mplayer site
- install codec in /usr/lib/codecs
- compile ffmpeg

You should now have an VP6 support
# Posted By Julien | 6/12/08 10:16 AM
I need to add a video conversion support to a website we are developing. I installed ffmpeg by yum utility. FLV's created with Flex (SWF8 or later) are throwing "Unsupported video codec" error. How can I add support for vc6? The rpm that is installed is ffmpeg-0.4.9-0.3.20051207.2.fc4. A quick response will be highly appreciated.
# Posted By WebTenet Solutions | 7/18/08 12:32 PM
For those running into "codec unsupported" issues, you should download the latest Windows build of ffmpeg here: http://ffdshow.faireal.net/mirror/ffmpeg/ and then give things a shot.

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.
# Posted By Nick | 9/1/08 5:38 AM