The main software component I use in developing the Truly Understanding Algorithms explanations is manim, for the animations.
However, I use a range of other tools, from Emacs to FFmpeg, going through ImageMagick, Audacity, and other tools for various tasks. I intend to use this series to document some of the most common uses for these tools, which I think are little-known or difficult to come by.
This post is about FFmpeg — a set of command-line tools that allow for various video processing, from cropping to blending or mixing going through padding and re-encoding (and many others).
Cropping a video file is so important, but most video editors make it unnecessarily cumbersome to do. Therefore it is best done with FFmpeg before editing.
To crop a video file using FFmpeg you have to setup a so-called filter:
ffmpeg -i movie.mp4 -filter:v "crop=1920:972:20:0" output.mp4
The command above takes the input file movie.mp4, runs it through the filter, which cuts out a rectangular region of size 1920 x 972 with an upper left corner at y = 20, x = 0, and saves the result into the file output.mp4.