Cropping video for comparison with FFmpeg

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. Cropping can reduce file size and isolate observables for comparison.

Once well understood, this process takes just a few minutes in post depending on the length of the source file.

This process utilizes the open source command line applications FFmpeg and ImageMagick. These applications can be installed with Homebrew.


  • 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"

  • FFmpeg and ImageMagick can then be installed with the following commands:

brew install ffmpeg
brew install imagemagick

Cropping video with FFmpeg:

Once a video clip has been captured, it can be cropped in the following way:

  • Navigate in terminal to the folder containing your video file.

  • Use FFmpeg to crop your video file with user defined dimensions and offset:

ffmpeg -i -filter:v "crop=800:534:159:6"

Comparing cropped video with contact sheets:

  • Video frames can be extracted, and a contact sheet can be made from this cropped file with:
ffmpeg -i -vf fps=1/1 -q:v 1 test-crop-glitch%2d.png
montage *.png -geometry 800x534 sheet-glitch.png

  • This process completed with a different crop offset produces a contact sheet of the same dimension for the dry output outlined in red.
ffmpeg -i -filter:v "crop=800:534:959:6"
ffmpeg -i -vf fps=1/1 -q:v 1 test-crop-dry%2d.png
montage *.png -geometry 800x534 sheet-dry.png

  • These sheets can be montaged for comparison by placing them in a folder and:
cd sheets
montage *.png -geometry 1600x1068 sheet-comparison.png

  • Timeline comparison is achieved by creating each sheet in either a single row or a single column, and then montaging both.
ffmpeg -i -vf fps=1/1 -q:v 1 test-crop-glitch%2d.png
montage *.png -tile x1 -geometry 800x534 sheet-glitch-row.png
ffmpeg -i -vf fps=1/1 -q:v 1 test-crop-dry%2d.png
montage *.png -tile x1 -geometry 800x534 sheet-dry-row.png
cd sheets
montage *.png -tile x2 -geometry 3200x534 sheet-timeline.png


Super helpful and thorough. Teach!