Thursday, May 22, 2014

How to capture still frame images from a video clip

I own a point-and-shoot digital camera which also shoots movies. As a novice photographer, I struggle in taking indoor evening pictures. Finally, I resort to first making a movie with the camera, followed by capturing still frames from the movie file. This post is part 1 of a 2-part series to explain the latter.

In this post, we go over how to capture, using a GUI tool, a single frame from a movie file. Part 2 presents the ffmpeg command to automate the video snapshot of multiple still frames.

VLC and Totem are 2 GUI-based video players which can take video snapshots. The rest of this post focuses on VLC.

To extract a single still frame from a video file:

  1. Open VLC and play the video file.
  2. Optionally, click the Pause button to freeze the playback at the frame of which you want to take a snapshot.

    You don't have to pause the playback to capture the frame. However, by doing so, you know exactly what is being captured.

  3. Take a snapshot by pressing the Hotkey combination Shift-S.

    Alternatively, click the Take Snapshot option in the Video menu.

By default, the video snapshot is saved to a time-stamped PNG file in your Home Pictures directory, for instance, /home/peter/Pictures/vlcsnap-2014-05-19-19h42m22s243.png.

You can customize the name, the location, and the image format of the picture file.

To customize,

  1. Select the Preferences option in the Tools menu.
  2. Click Video to bring up the Video snapshots settings.
  3. Change the Video snapshots settings.
    • Directory

      Specify the directory for holding the output picture files.

    • Prefix

      Specify the prefix which is the first part of the output file name.

      $T is a special variable that you can insert into the prefix, e.g., "vlcsnap-$T-". To generate the file name, VLC replaces $T with the elapsed timestamp of when the snapshot was taken relative to the start of the video. For instance, the file name vlcsnap-00_05_37-2014-05-19-19h42m22s243.png indicates that the snapshot was taken at 0 hour 5 minutes 37 seconds into the video.

    • Sequential numbering

      By default, Sequential Numbering is disabled. VLC appends the file creation timestamp to the prefix. For instance, the file vlcsnap-00_05_37-2014-05-19-19h42m22s243.png was created at 7:42 pm on May 19, 2014.

      If Sequential Numbering is enabled, the creation timestamp is replaced by a sequential numbering scheme, starting at 1 (vlcsnap-00_05_37-00001.png).

    • Format

      Choose either PNG or JPG.

  4. Restart the VLC application.

Part 2 introduces the ffmpeg command to automate the video capture of multiple still frames.

No comments: