How can I extract an image from a particular time of a video in Xubuntu 16.04?

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


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.