How To Shrink the File Size of a Screen Recording on Mac

Learn how to take your QuickTime screen recording and reduce its file size by up to 10x!

MacVideoffmpeg

In this tutorial, you will learn how to reduce the file size of your QuickTime Movie using ffmpeg. This process can reduce file sizes by up to 10x, making them sendable in emails or postable on GitHub PRs on the free account.

Step 1 — Install ffmpeg

To get started, you need the following:

  • ffmpeg — an open-source image and multimedia processing framework.

To get it, you can either install it from its website:

Download FFmpeg

Or, my preferred option, you can download it with homebrew. Homebrew is a package manager for macOS. You can download it here if you don’t have it already:

Homebrew

Once you have homebrew installed, you can run the following:

bash
brew install ffmpeg

This will install the following Homebrew formula:

ffmpeg

Whatever you choose, get ffmpeg installed and move on to the second step.

Step 2 — Shrink Your File!

With ffmpeg installed, crack open a terminal. To do so, open Launchpad and type terminal in the top search bar:

Click on that, and you’ll have a terminal loaded. To shrink the video size type this command into the terminal:

bash
ffmpeg -i <path-to-your-quick-time-movie>.mov -vcodec libx264 -crf 23 \

Fill in these fields:

  • <path-to-your-quick-time-movie> (it should end in .mov)
  • <your-new-path-and-file-name> (it will be a .mp4 file)

If you don’t understand how paths work in the terminal, read this:

Beginner's Guide to macOS and Linux Terminal Commands - The Apple Geek

The other options in the command are:

  • -vcodec libx264 — This is the name of a video codec, the software we’re going to use to recompress the video.
  • -crf 23 — This stands for the constant rate factor, which controls the quality of the video. The range is from 0 (lossless) to 51 (very lossy). Typical values range from 18 for decent quality to 28 for lossy but acceptable quality. I’ve chosen 23 as a happy medium.
  • -preset slow — Controls how much time ffmpeg spends trying to produce an efficient compression. The slow value requires more CPU time but will result in a smaller file size. fast speeds up compression but produces larger file sizes.
  • -vf "scale=-2:1080" — Applies a video filter that resizes the video. The height is set to 1080 pixels, and the width is automatically calculated to preserve the original aspect ratio. The -2 ensures the computed width is divisible by 2, which is required by many video codecs.

Run the command above, and you will see output like the following:

bash
frame=4961 fps=393 q=31.0 size=3072KiB time=00:01:22.65 bitrate=304.5kbits/s speed=6.55x elapsed=0:00:12.61 

This is recompressing your video! If your video is under 5 minutes in size, this will take less than a minute. You can see the actual speedup given above as speed=6.55x, in other words, the video is compressing 6.55 seconds of video every second.

The result, a 10x size decrease for a small quality drop:

Extras — As a Shell Script

If you understand how to manage your Terminal’s shell in macOS, then you can add the following shell script to your source file:

bash
# Used to shrink the size of QuickTime recording

This can be used like this:

lua
shrink-vid "input/file/path.mov" "output/file/path.mp4" --d

Add the --d flag if you want to delete the input video. If you don’t provide an output file path, the input file path will be used and overwritten.

Final Words

That’s it! I hope this helps you send videos to friends and colleagues in emails, and keeps you posting UI walkthroughs on GitHub PRs. Happy compressing!