FFMPEG: Screen-recording and video compression made fast and easy (MacOSX guide)

FFMPEG: Screen-recording and video compression made fast and easy (MacOSX guide)


You probably already know the "Why" since you're here, or probably you're just a knowledge devourer that wants to know stuff just because one day it might come in handy (trust me, this might come in handy one day).

In your life as a developer you might need to make screen recordings to send to your colleagues or clients to showcase (the progress of) something you've developed. And these screen recordings can result in pretty big file sizes depending on the resolution and the length of the recording. Big files don't work well with slow upload speed and also they take more space on a server ("Thanks Captain Obvious!" - said someone from the audience).

So, since video compression is a thing, I'm going to help you compress those chonky files and help you decrease the effects of the aforementioned problems.


The only additional things you will need to accomplish this task are:

  • Homebrew - a package manager for MacOS (makes life a lot easier)
  • ffmpeg - a CLI tool which allows video format conversion, compression etc.
  • basic terminal knowledge (traversing the file system)

Installing the pre-requisites

  1. Open a terminal window
  2. Install Homebrew by running this:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Install ffmpeg by running this:
    brew install ffmpeg

Screen-recording tutorial

Recording your screen on MacOSX is as easy as pressing Cmd + Shift + 5. I won't explain further, the tool is quite intuitive, fiddle around with it and you'll get familiar with it quite fast.

NOTE: To make your life easier rename your recording to something short and simple like "a.mov".

Video compression tutorial

  1. Open a terminal window
  2. Go to the recording's location (using the terminal of course)
  3. Run:
    ffmpeg -i {recording-video} -vcodec libx264 -crf 24 {output-video}

The {recording-video} and the {output-video} have to contain the file extension as well. (i.e.: ffmpeg -i a.mov -vcodec libx264 -crf 24 b.mov)

And that's about it. If you want to know more about what the options for ffmpeg mean, keep on reading.

Breaking down the ffmpeg command

Let's dissect the command first:

ffmpeg | -i {recording-video} | -vcodec libx264 | -crf 24 | {output-video}

Now let's explain it:

  • ffmpeg is the name of the CLI tool
  • -i is an option which takes the name of the input video (the video which we want to work on)
  • -vcodec is an option which takes the video codec's name (in our case it's libx264)
  • -crf is an option which determines the constant rate factor (I know it's wrong, but I remember this as compression ratio factor, which makes it easier for me to remember that higher values mean higher compression and lower video quality/size)


I hope this post helped you learn something new. This may serve as a short introduction to ffmpeg for you as well, which is a powerful CLI tool. You can learn more about ffmpeg here.

Also, I've made a multi-platform tool which installs everything automatically. You can look at it here.