This post is LONG overdue. I’ve been playing FFmpeg for a long time now and through trial and error, along with this page, figured out how to extract a JPG frame from a video at a specific time. A reader recently posted a question asking how to get this done and I hope he doesn’t mind me posting a frame grab here:

This came from a Windows Media file and was grabbed using the following command:
ffmpeg -i n.wmv -ss 00:00:20 -t 00:00:1 -s 320×240 -r 1 -f singlejpeg myframe.jpg
If you haven’t seen FFmpeg’s overwhelming parameter list then beware. This might look like a complicated command, but given FFmpeg has over 100 parameters this really isn’t much. Here’s what the parameters mean:
-i input file name
-ss set the start time offset
-t set the recording time
-s set frame size (WxH or abbreviation)
-r set frame rate (Hz value, fraction or abbreviation)
-f force format
The last paramter is actually the output file name. I can’t tell you how excited I am to finally get this working. If you have any problems with the command above then please be sure to contact me.
This command doesn’t work neither linux debian nor windows server 2003.
But if you change the -f force format to this->
ffmpeg -i %1 -ss 00:00:20 -t 00:00:01 -s 320×240 -r 1 -f mjpeg %2.jpg
it will be work.
Emilio
You article was very useful for me.
Best regards
If you’re a PHP fan, there’s always ffmpeg-php which does it all for you
http://ffmpeg-php.sourceforge.net/
Hi, I got here through this post http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-July/003526.html
I just wanted to add how I was able to get a few frames (it’s hard to get the right one on the first try) with this:
ffmpeg -ss 0:1:36 -t 1 -i movie.avi -f image2 image-%d.png
It uses the movie size and grabs 1 second (-t 1) worth of png images into image-1.png, image-2.png, etc. Depending on the encoding, you might get 24 or 30 images or something else.
I got it working in a perl script that produces one png shot at any time:
ffmpeg -ss 0:10:00 -t 1 -s 400×300 -i input.avi -f mjpeg output.png
I am running ubuntu.