I am looking for a command line option.

For example, if I have the video sample-video.mp4, and I want to generate an image file sample-image.jpg from the video at time 00:00:26, what command should I give?

Also, it would be very helpful if you can explain in detail what the function of every argument of the command is.

  • 2
    According to this question and its answers ffmpeg seems to support filenames for the output.
    – IQV
    Jan 18, 2018 at 12:01

2 Answers 2


You can use ffmpeg

ffmpeg -loglevel quiet -ss 26 -i sample-video.mp4  -t 1 -f image2 anyfilename.jpeg
  • -loglevel set the logoutput to quiet because ffmpeg is very chatty
  • -ss is seek (in seconds, i.e. where you want to take the snapshot)
  • -i input video file
  • -t timeframe of the snapshot (in seconds)
  • -f filetype

You can also play around with the options, like control quality of the jpeg output -q:v <linear integer 1-10> or resolution -s 480x300 .

Some more ideas here

VLC Method

cvlc sample-video.mp4 --start-time=26 --run-time=1 --rate=1 --video-filter=scene --vout=dummy --aout=dummy  --scene-ratio=24 --scene-prefix=sample-image --scene-replace vlc://quit
  • cvlc - because its command-line and we don't want any windows opening. also, this means we can run it without X11.

  • --start-time=26 - is the exact position of the snapshot in seconds

  • --run-time=1 - how long the video will "play" in seconds. We play it for one second to make a screenshot of this second
  • --rate=1 when to take the screenshot. This basically means "every second" and is useful, if you have longer files, to take a screenshot every 60 seconds or every 5 minutes
  • --video-filter=scene tell VLC that we want to take screenshots
  • --vout=dummy no output for video on X11, we don't need it
  • --aout=dummy no output for audio, we don't need it
  • --scene-ratio=24 we tell VLC that there are approx 24 frames per second
  • --scene-prefix=sample-image the filename of your screenshot
  • --scene-replace replace any files that are called like your screenshot sample-image.png with your current screenshot. If you omit this, VLC will start numbering the screenshots
  • vlc://quit quit vlc once we are finished

Complete documentation here

  • What do you mean by chatty? And I want a snapshot at the 26th second. So why specify timeframe by -t. I am taking image not video.
    – Sonevol
    Jan 18, 2018 at 12:40
  • 3
    "Chatty" because ffmpeg prints over 40 lines of log output with this command, like the current version, setup type and information about the input video file - which is uninteresting for you. For your purpose you can probably omit "-t 1". Seems the default is one second or a fraction of that, which is fine for the screenshot. The nice difference is the possibility to define the output filename and tweak quality/resolution, etc Jan 18, 2018 at 12:48

You can use mplayer (from package mplayer, not installed by default):

mplayer -vo jpeg -ss 00:00:26 -frames 1 sample-video.mp4

This will create the file 00000001.jpg so you have to rename it. As far as I know there's no way to specify a filename.

-vo jpeg means you want JPEG output, -ss 00:00:26 seeks to the given position, -frames 1 means to process one frame and then quit.

  • What is the advantage of getting more than 1 frames? Will those be copies or each frame will differ by a second?
    – Sonevol
    Jan 18, 2018 at 11:56
  • Images created from more frames will differ by fractions of a second. Tjhe exact value depends on the video. Jan 18, 2018 at 12:31
  • 5
    @Sonevol The frame exactly at 0:00:26 may not be exactly what you want. You may want to take the ~50 frames between 0:00:25 and 0:00:27 (or even just 3-4 frames around the 0:00:26 mark) and then browse through them to pick the best one.
    – xDaizu
    Jan 18, 2018 at 15:45
  • 1
    @FlorianDiesch Possible also to output to png with something like: -vo png:z=9 with the -z setting specifying compression level. For jpeg you could also add in a quality setting: -vo jpeg:quality=100. But your answer is great as it is already :)
    – andrew.46
    Jan 19, 2018 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.