How to GIF

GIFs, putting in work.

We love animated GIFs because they let us communicate so much with so little. They’re visual, cyclical, and easy to share — powerful features for communicating unfamiliar concepts to an unfamiliar audience. This is why we think it’s important to learn how GIFs can be used strategically in education. We are all involved in online safety education and, following a session we co-organized on this topic at RightsCon, wanted to share what we’ve learned along the way in three posts:

  1. GIF JIF ZHAIF: Teaching an educational GIF workshop at RightsCon
  2. If you’re not using GIFs to reach & teach your community, what are you doing?
  3. How to GIF

Okay, so how do you GIF?

There are no shortage of ways to make a GIF. Let’s walk through a few different tools that can help.

  1. LICECap is a simple, fast desktop GIF-making tool.
  2. Giphy is an easy-to-use website for uploading, converting, and sharing GIFs.
  3. FFmpeg, a powerful command line tool for manipulating video and images.

We can’t cover them all, but there are other great options out there as well! (e.g., EZGif.com, Peek for Linux).

After you make your GIF, you can upload it to social media sites (e.g., Twitter), publishing tools (e.g., Google Docs or Slides), or whatever supportive site makes you happy inside.

A few GIF tips
GIFs can only support 256 colors. That sounds like a lot, but if you record something with a lot of colors (e.g., a lengthy GIF), the quality of your GIF will degrade. So try not to put too much into one GIF, and break them up into multiple files when necessary.

Most sites won’t let you upload a GIF that’s too big (e.g., Twitter caps GIFs at 15 MB). Consider how to make the most of your GIF files by creating smaller files with lower quality (or fewer frames), or making shorter GIFs with better quality.

Finally, consider your audience. Are they aren’t in a location with good bandwidth, or if they have limited data, smaller images may be better for them.

LICECap

First, download and install LICECap at the following site: https://www.cockos.com/licecap/

To use LICECap

  1. Open LICECap and drag the window over whatever you’d like to record into your GIF. Hit record to record. Hit stop to stop.
  2. … There is no number two. Enjoy your GIF.

Note, when you click “Record” there is a “3 2 1” countdown, so make sure to start recording whatever you want to record 3 seconds early. Getting the timing just right can take a couple of tries. You can also change the frames per second in the bottom left corner of the window.

GIPHY

Giphy allows you to easily upload, convert, host, and share GIFs from your browser. It’s pretty straightforward.

First, navigate to giphy.com. Navigate to “Create” at the top right corner. You can click and drag videos of your choice into the window to create your GIFs. You can even pull in a video from YouTube, or add individual images and turn them into a GIF.

It’s also an easy way to host and share GIFs you already have. Click “Upload” at the top right corner and go through the same process.

FFMPEG

An example of an FFmpeg GIF with a custom palette

If you have the unfortunate honor of being comfortable with the command line, FFmpeg is a powerful command line tool for manipulating video. It can give users very fine-grained control over conversion of dozens of file types. You can transform just about any visual file into a GIF. This can be useful for creating high-resolution GIFs as well. However, as a command line tool, it’s much more involved than tools like LICECap.

Depending on your operating system, we may install it in a few different ways.

Mac users: 
Open your terminal application under Applications >Utilities > Terminal.app

If it’s not on your device already, install homebrew — a handy tool to help you manage and download software. In your browser, navigate to https://brew.sh/ and follow the instructions.

Once homebrew is installed, install ffmpeg by typing the following into your terminal:

brew install ffmpeg

Windows users: 
Download the most recent FFmpeg for Windows at https://ffmpeg.zeranoe.com/builds/

  1. To install ffmpeg, first we need to unzip it using a tool like Winzip or 7zip. Unzip it into a folder that’s easy to find (e.g., directly into the C:\ drive, leaving you with C:\ffmpeg\)
  2. Next, we need to change the system path to make it recognize FFmpeg, so we can enter ffmpeg commands from our command line. Navigate to
    Start menu > right click on Computer > Properties > Advanced System settings > Environment Variables > Edit
  3. At the end of the “Variable value” field, add “;C:\ffmpeg\bin” (or change this line to match where you left your FFmpeg folder).

This may sound like a lot, but you can do it! For these instructions with screenshots, go here: http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/

Now you can start using it!

Linux users: 
It’s likely how you imagine.

sudo apt-get install ffmpeg

Using FFmpeg
FFmpeg lets you manipulate the length, framerate, and color palette for a GIF. It also allows you to break up a movie file into individual frames, edit them, and change them back into a GIF. Let’s start with some simple examples.

Convert video into GIF:

ffmpeg -i video.avi my_gif.gif

Change the frame rate or size of your GIF recording:

ffmpeg -i video.mp4 -r 20 -vf scale=472:-1 images.gif

‘-r 20’ gives the GIF 20 frames per second, and a width of 472 pixels and a proportionate height.

Left: Original conversion into a GIF. Right: 20 frames per second.

Create a clip from a section of a video:

ffmpeg -t 3 -ss 00:00:02 -i small.mp4 small-clip.gif

In this example, we record a 3 second GIF starting at 2 seconds into the video. Change 3 to change the length of the GIF, and 00:00:02 to change when the video records.

Turn a video to X images:

ffmpeg -i video.mpg image%d.jpg

You can break out the file video.mpg into individual frames (e.g., image01.jpg, image02.jpg, and so on…)

Turn X images to a GIF:

ffmpeg -f image2 -i image%d.jpg example.gif

Now you can stitch together the files you made (e.g., image01.jpg, image02.jpg, etc.) into a single GIF, example.gif.

Remember, GIFs can only support up to 256 colors. To make a great color combination, FFmpeg allows you to generate your own palette file. In the following example, we generate a palette file (palette.png) from video.mp4 with 20 frames per second, as well as a width of 472 pixels and a proportionate height (‘scale=472:-1’).

ffmpeg -i video.mp4 -vf \ fps=20,scale=472:-1:flags=lanczos,palettegen palette.png

Use your new palette to make a higher quality GIF without those funky colors and dots:

ffmpeg -i video.mp4 -i palette.png -filter_complex “fps=20,scale=472:-1:flags=lanczos[x];[x][1:v]paletteuse” video.gif
Before and after customizing GIF palettes.

Don’t stop here

We’ve looked at a few pieces of software that can assist you in your GIF adventures, but don’t stop here. There are countless other fantastic tools (e.g., EZGif.com, Peek, and others) that may be even better, depending on your needs. See what works best for you.