Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to take a frame of a video at a certain percentage of time (for example, 25%, 50% and 75%) and save it somewhere.

I need this to be done from the command-line so I can automate it. Also, this needs to be done in Windows.

Does anyone know how to do this?

share|improve this question
Which file format is the video(s) encoded in? – iglvzx Jan 30 '12 at 19:34
Oh, sorry. They're in XviD (in AVI) and h264 (in MKV) mostly, they're videos from different TV series. Thanks! – brott Jan 30 '12 at 19:39
possible duplicate of Take a screen shot from command line in Windows – Ƭᴇcʜιᴇ007 Jan 30 '12 at 20:15
@techie007 NOT a duplicate... This is basically about taking a frame from a video file and saving it as an image... Not about taking a screen shot of the entire screen. – BloodPhilia Jan 30 '12 at 21:09
up vote 4 down vote accepted

You might want to use ffmpeg for Windows with the following command:

ffmpeg -i <INPUT FILE> -ss 10 -f image2 -r 25 <OUTPUT FILE>
  • -i <INPUT FILE> Specifies the input file. E.g. movie.mp4.
  • -ss <TIME> Specifies time position in seconds. "hh:mm:ss[.xxx]" is also supported.
  • -f image2 Force/Set format.
  • -r 25 Set frame rate (in Hz. Can either be a fraction or a number, default = 25).
  • <OUTPUT FILE> Set output file. E.g. image1.jpg.

If your source video has a fixed frame rate, you can capture a specific frame using this formula:


So if you want to capture frame 250 at a 25Hz frame rate, you set -ss to 10.

share|improve this answer
You can probably use wmi to pull the time length property from the video file, do some division on the output, then use that as the input for -ss. – Mechaflash Jan 30 '12 at 21:26
Thank you very much! Although it didn't quite work (I got this and it never stopped:, it pointed me here:… and that worked. Thanks! @Mechaflash What is wmi? It sounds very useful! Thanks! – brott Jan 30 '12 at 22:03
@brott wmi is apart of the windows envrionmement that deals with windows objects and their properties. In your case the object is the video file and the property is the time length of the video. Information on WMI:…. Information on using WMI in windows batch-file scripting: – Mechaflash Jan 30 '12 at 22:26
That's very useful, thanks, @Mechaflash! – brott Jan 30 '12 at 22:30
Try the following command on your video file: wmic datafile where name='C:\\Path\\To\\Video.xvid' > WMIoutput.txt Please note the double \ and single quotes. Check the WMIoutput.txt file that it created and see if it shows some sort of time or duration of the video. I tested this on a mp3 file and it didn't return that sort of field for me. – Mechaflash Jan 30 '12 at 22:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .