← Blog
Twelve frames of a sailboat moving across a bay, read left to right from 0:00 to 1:50 in ten-second steps.
Published on

Make a video contact sheet with FFmpeg

A course editor has a folder of finished lessons to review. Opening each video and scrubbing at random makes it easy to miss a sideways slide or pick up the wrong revision. A video contact sheet gives each clip a one-page visual index. Scan the sheet, identify a frame that needs attention, then open the original video near that time.

In the example above, the boat should move across the bay as the lesson plays. Each row follows it for another forty seconds. The timestamps were drawn into the source clip, so they let us check exactly which frames FFmpeg selected. Open the full-size contact sheet to inspect all twelve frames.

Choose twelve moments across the clip

Start with the question the reviewer needs to answer. For a first look at a two-minute export, one frame every ten seconds gives twelve samples. Arrange them in four columns and three rows. Read left to right, then move down one row:

  • Top row: 0:00, 0:10, 0:20, 0:30.
  • Middle row: 0:40, 0:50, 1:00, 1:10.
  • Bottom row: 1:20, 1:30, 1:40, 1:50.

If the third tile in the middle row shows the wrong slide, start playback around 1:00. The final tile represents 1:50. To check the closing credits or a fault in the last few seconds, play the end separately.

Build the contact sheet with FFmpeg

With FFmpeg installed, open a terminal in the directory containing the export. The example assumes square pixels and one main video stream. Substitute your input filename and choose a fresh output name. Paste the command as one line.

ffmpeg -hide_banner -loglevel error -n -i lesson-07-r2.mp4 -map 0:V:0 -vf "setpts=PTS-STARTPTS,select='isnan(prev_selected_t)+gte(t-prev_selected_t,10)',scale=320:180:force_original_aspect_ratio=decrease,pad=320:180:(ow-iw)/2:(oh-ih)/2,tile=4x3:padding=4:margin=4:color=black" -frames:v 1 lesson-07-r2-sheet.png

-map 0:V:0 picks the first video stream other than an attached picture such as cover art. For an export with several camera angles or video tracks, identify the stream you want before sampling. -n protects an existing sheet from being overwritten.

setpts measures time from the start of the video. The selection expression keeps the first frame, then the first available frame at least ten seconds after the previous selection. The times in the grid above are exact for this one-frame-per-second example. With irregular frame timing, use the actual selected frame timestamps if the reviewer needs precise seek points. This command does not print labels onto an unmarked video.

scale fits each frame inside a 320-by-180 box while preserving its shape. pad fills the remaining space, so a portrait frame can occupy a narrow strip in the center. The FFmpeg tile filter arranges the frames into a grid with four-pixel gutters and a four-pixel border. -frames:v 1 writes one sheet.

Adjust the interval before processing a folder

Divide the clip duration by the number of tiles to choose a starting interval. For an eight-minute lesson and twelve tiles, try forty seconds between frames. Keeping the ten-second interval and writing only one sheet would spend the entire grid on the opening two minutes. If a reviewer needs ten-second coverage throughout a longer lesson, plan multiple numbered sheets instead.

A short clip may supply fewer frames than there are cells. Choose a smaller grid or a shorter interval and record which you used. Empty cells at the end of a sheet need a different interpretation from black frames sampled from the video itself. For a title card that flashes past between samples, use playback or inspect that section at a closer interval. For audio, motion and captions, use the playback checks in the video transcoding guide.

Keep the sheet attached to the right export

Include the source name and revision in the output, as in lesson-07-r2-sheet.png. Keep a small list of the inputs, selected streams, intervals and finished sheets for each delivery. If one decode fails, record that clip for review. An older sheet from a previous delivery can otherwise make a failed export look complete.

For an occasional folder, a local run gives the editor an easy place to inspect the images. A recurring delivery may justify a CPU VM if the team needs access to shared media and a predictable unattended run. Try representative source codecs, durations and dimensions before choosing a machine. Record elapsed time, peak memory and temporary storage, including the effect of processing more than one clip at once. Use those observations with the CPU VM buying guide.

What we checked. We ran the command locally with FFmpeg 7.1 on one synthetic, two-minute, 480-by-270 video. The resulting PNG measured 1,300 by 556 pixels. We inspected all twelve visible clock labels and their grid positions. Portrait and variable-frame-rate inputs, batch recovery, scheduling and cloud deployment remain untested.

Your next workload belongs on Hivenet.

Pick one AI, compute, or storage workload and see the difference for yourself. Spin it up in minutes, or let our team map your fastest path to production.