The best way to convert a screen recording (or any video) to a gif both in quality and size

A gif of a screen recording has proven itself to be a very practical solution to make tutorials easier to understand. The gif has the big advantage that you don’t need to think about a video-player for your blog or host each small video on a video hosting platform like YouTube.

I’ve tested many solutions to convert videos to gifs to receive nice quality with a relatively small size. Some software solutions I tried are GIF Brewery, Cloud App, GifMaker, GifFox, Drop to GIF but all of them had some drawback, either the file size turned out to be to big or the quality was disappointing.

The solution I found unfortunately can only be used with the terminal, but don’t be afraid, I’ll guide you through it.

Installing the prerequisites brew & ffmpeg

The converting is done via ffmpeg a open-source software that can do pretty much anything related to video/audio. So it doesn’t hurt to have it on your machine.

Step 1) Install brew

I’ve found that the easiest way to install ffmpeg on a mac is actually with brew, the so called „missing package manager for OS X“.

So head over to brew and install it by copying the command shown into a fresh terminal window. (Terminal is a preinstalled Application, if you’ve never heard of it. Just locate it in your Applications folder and open it)

install-homebrew

Step 2) Install ffmpeg

Once brew is installed you can just type one simple command to install ffmpeg into a terminal window:

brew install ffmpeg

install-ffmpeg

Using ffmpeg to convert to gif

I’ve found this very helpful blog-post which explains in detail what’s going on in the background. I’ve just extracted the most important part for you. How to use the script.

First of all you’ll need to to download a small script for the conversion settings of ffmpeg. I prepared a folder which you can then use for your conversions.

Download

Step 1) Adjust the settings

Extract the zip and go ahead and open the gifenc.sh file in your text editor of choice (e.g. TextEdit or Notepad). The only value I change is the one at „scale=XXX“ – it defines the output files with in pixel. The lower the pixel with the lower the output size. So only go as high as you need it to be. Be sure to save the file with .sh file extension still intact otherwise it won’t work.

Step 2) Put everything to work

Place the video file you want to convert in the folder and open up a terminal window (if not still open)

Type „cd“ and drag the folder containing the gifenc.sh file into the terminal window.

move-to-folder

Type the following command „bash gifenc.sh“ and drag the video file to the terminal two times. Delete the video extension of the last file and type .gif instead … or just follow along this gif:

gif-conversion

Have fun converting and let me know if you have a better / easier solution that can compete with this one.