Preparing video files for Discourse or FB can create challenges that delay or discourage sharing. Viewing high quality video not only requires an investment of time, but also consideration of loss due to compression. A contact sheet provides an economization of time and file size when used as a companion or substitute for long format video.
Once well understood, this process takes just a few minutes in post depending on the length of the source file.
- Will this work on my operating system?
From FFmpeg’s About:
FFmpeg is the leading multimedia framework, able to decode , encode , transcode , mux , demux , stream , filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
From ImageMagick’s Home:
Use ImageMagick to create, edit, compose, or convert digital images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF. ImageMagick can resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
The current release is ImageMagick 7.1.0-19. It runs on Linux, Windows, Mac Os X, iOS, Android OS, and others.
Installing Homebrew, FFmpeg, and ImageMagick:
If your operating system does not come with FFmpeg or ImageMagick already installed, Linux, Windows 10, and Mac users can use Homebrew to install both.
- Homebrew can be installed with the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- FFmpeg and ImageMagick can then be installed with the following commands:
brew install ffmpeg
brew install imagemagick
Creating Contact Sheets with video frames from FFmpeg:
Once a video clip has been captured, it can be converted into a time lapse contact sheet in the following way:
- Navigate in terminal to the folder containing your video file.
- Use FFmpeg to extract stills from your video file at a user defined rate:
ffmpeg -i input.mov -vf fps=1/1 -q:v 1 output%02d-1fps.png
- Use ImageMagick to montage extracted stills into a contact sheet:
montage -geometry 720x486 *.png sheet-output-1fps.png
Basic adjustment of parameters:
The above commands extracted stills at a rate of 1 frame every 1 second and montaged them on a sheet named sheet-output-1fps.png.
- The following commands will extract stills at a rate of 1 frame every 5 seconds and montage them on a sheet named sheet-output-1every5.png.
ffmpeg -i input.mov -vf fps=1/5 -q:v 1 output-1every5%02d.png montage -geometry 720x486 *.png sheet-output-1every5.png
- If for instance, I wanted this montage to conform to a single column or to a single row:
montage -tile 1x -geometry 720x486 *.png sheet-output-1col.png
montage -tile x1 -geometry 720x486 *.png sheet-output-1row.png