For situations when we need to upload a compressed video to a website or when we need to quickly send a copy of the video to someone and full-res, low compression doesn’t work, there are two tools that work well for this purpose.

Handbrake is a graphical tool that can easily convert videos to various formats. FFMPEG is my preferred tool of choice for converting videos to a useable format because it tends to have a lot more flexibility and I can easily batch the commands one after another. The rest of the article discusses how to use the command line program.

FFMPEG is a command line tool, so the learning curve might be a bit steep, but the only commands you need to know is how to use cd (change directory) to get to the video location. https://ss64.com/bash/cd.html

  1. Download the most up to date version of FFMPEG here: https://www.ffmpeg.org/. Be sure to get the static MacOS version.
  2. Decompress and copy the file to the video file’s location.
  3. In terminal (located in Applications/Utilities), navigate to the video’s location. (KISS, just put it in a directory on the desktop).

In terminal you can run ffmpeg by typing in the following:

./ffmpeg

That’s dot forward slash. This will give you information about the program, but won’t do anything.

To compress a video you can use the following command:

./ffmpeg -i “ORIGINALFILE.ext” “NEWFILE.mp4”

This command takes FILENAME.ext and converts it to FILENAME.mp4 with default settings.

If we want to compress the video, we can use the -crf (Constant Rate Factor) flag. This flag attempts to maintain a certain level of quality throughout the entire video. CRF runs on a scale of 0-51 where 0 is lossless and 51 is worst quality possible. For web video, I tend to encode at 23-30 depending on needs.

If we want to resize the video, we can use the -vf flag. The proper use is -vf scale=xxxx:yyyy. You can define explicit width and height values or you define one dimension explicitly and use -1 as the other dimension. This will maintain the aspect ratio of the video. However, this flag may result in an error if the other dimension isn’t divisible by 2.

The final command can look like this:

./ffmpeg -i “ORIGINALFILE.ext” -crf 23 -vf scale=-1:1080 “NEWFILE.mp4”

Here are some other other fun things you can do with ffmpeg:

  1. Extract audio and convert to an mp3: ./ffmpeg -i “ORIGINALFILE.ext” “NEWFILE.mp3”
  2. Remove audio from a video file: ./ffmpeg -i “ORIGINALFILE.ext” -an “NEWFILE.ext”
  3. Export video as an image sequence: ./ffmpeg -i “ORIGINALFILE.ext” “IMAGENAME-%05d.png” – The number refers to the amount of digits in the file name.
  4. Export an image sequence as a video: ./ffmpeg -i “IMAGENAME-%05d.png” “VIDEO.mp4”