Man, I don’t think I could dig up all the tutorials I used (but I found this tutorial on giphy to be the most useful – which given that it’s giphy, I’m not surprised). I don’t mind talking about it but… my process might not be for you since I don’t use photoshop (even though I do have it). However… all the apps/programs I use are 100% free and open source, so there’s that.

I ought to mention that I’m a linux user and I love the commandline, so that’s like… 80% of my workflow. Because I’m me, I wrote a ruby script to help automate a lot of what I do. I’d share it but… I’m a terrible coder, lol. I also have zero idea how to make it cross-platform useable (I suppose I could look into packaging it into a gem… who knows, maybe I will!)

Programs/apps

All of these programs are availabe on mac, windows, and linux.

  • FFmpeg

    This is like… the backbone of most audio/video processing on all platforms. As you saw in the giphy post, this is probably how they make gifs in the backend. I use this for a lot more than making gifs since it can pretty much do anything you want with audio and video. However… because it’s so powerful it’s also really complex and confusing. I tend to google a lot and when I find what I want, I write a script so I don’t have to try and remember it.

  • Avidemux

    Not strictly necessary. This is the only GUI I use. It’s a really basic video editing program, I use it for cutting up clips and—in the case of gifs—for accurate time-seeking, since you can advance the video frame-by-frame.

  • gifsicle

    Also not strictly necessary but it’s useful for manipulating gifs (cropping, changing the delay speed—something you can do with ffmpeg but I’m not sure how, how many loops, etc.)

1. Clip video scenes

This is always my first step, regardless of how many gifs I make.

I start with a high-resolution video that I want to gif. The better quality video you start with, the better your gif will be. But… they also take up a lot of space. I don’t need an 8gb version of The Domestics (especially since it’s unlikely I’ll ever watch it). So I trim the scenes I want using avidemux.

Another reason for this (and it’ll be obvious later on) is that I don’t save my gifs on my harddrive. Gifs are a terrible way to store moving images because they tend to be gigantic. Instead, I save the video clips.

2. Making a single basic gif

a) Use avidemux to get the time stamps.

So this step is all about using avidemux to seek through the video for time stamps. When looking for the time stamps it pays to be as exact as possible. For example, 00:00:16.974–00:00:18.017, instead of 00:00:16–00:00:18 (time stamps as, HH:MM:SS.SSS). This is why I use avidemux instead of a regular video player.

b) Use ffmpeg to make the gif!

At this point, you have everything you need to make the most basic gif. By which I mean, no cropping, scaling, or anything else.

Here’s the basic ffmpeg command (on linux):

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

This part -filter_complex '[0:v] split [a][b];[a] palettegen [p];[b][p] paletteuse' isn’t strictly necessary but it helps with the colours to make a better looking gif, so I always use it.

Note: if you did start with a high-res video, the gif will be huge. At the very least, you’ll want to scale the image (esp, if you’re posting on tumblr.

3. Optimize the gif (Frame rates, Scaling, Cropping, Adjustments, and Delays)

This part is all about using ffmpeg filters to manipulate the gif in various ways (usually to make it smaller but also to make it look nicer!).

a) Frame rate

Most video has a framerate of 24 frames/second [fps]. This is way more than a gif needs. My default is 15fps but I think a lot of gifs are 10fps. Either way, you’ll want to adjust it. The fewer frames, the smaller the gif (but also more choppy). Here’s how the ffmpeg command looks with the the fps filter (change the value of ‘fps=15’ to however many frames you want):

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v] fps=15, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

Easy enough…

b) Scaling

This step will dramatically reduce the size of your gif.

A full width tumblr image is 540px. The next size is 268px, which I’ll use here so that this post doesn’t have too many large gifs.

When scaling, I always apply the smartblur filter because it prevents the gif from looking fuzzy (I never adjust the value).

Here’s the ffmpeg command with the scale filter:

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v] scale=268:-1:flags=lanczos, smartblur=ls=-1.0, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

The scale filter isn’t too complicated. The basic format is ‘scale=width:height’. You can put any values for ‘width’ and ‘height’. The ‘-1’ in the command tells ffmpeg to automatically adjust the height to keep the aspect ratio (which prevents the gif from looking weird and stretched).

c) [optional] Cropping

I like to crop my gifs to show only what I want to show. This sometimes results in larger gifs, as it can increase the overall area. I have my reasons for preferring the square gifs I frequently post.

So here’s the ffmpeg command with the cropping filter:

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v]crop=1620:ih:300:50, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

This command can get… complicated. The values look like this ‘crop=width:height:x-axis:y-axis’. Width and height are easy enough, they determine the size of your crop square. The x and y values… If you leave them at the default 0, it’ll start at the top left-hand corner. Increase the value of ‘x’ to shift the crop square right. Increase the value of ‘y’ to shift the crop down. It’ll take a little trial and error to get the correct position.

cropped gif

d) [optional] Use the eq filter to adjust brightness, contrast, gamma, and saturation

I use the eq filter for these adjustments. For this filter, adjust brightness by small increments (I almost never go higher than 0.2 and sometimes as low as 0.01). Adjust the gamma if you want to ’lighten’ the image. Of course, the difference between brightness and gamma is hard to understand (I just looked up what ‘gamma correction’ was and found a bunch of way too technical articles). Play around. One thing to note, if you increase brightness/gamma, you should increase the contrast.

Here’s what the eq filter with it’s default values looks like:

eq=brightness=0:contrast=1:gamma=1:saturation=1

Adjust the values by decimals depending on the level. Brightness ranges between -1.0 and 1.0, default of 0. Contrast between -1000.0 to 1000.0, default of 1. Gamma 0.1 to 10.0, default of 1. Saturation between 0.0 to 3.0, default of 1.

And here’s the ffmpeg command with this filter:

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v] eq=brightness=0.12:contrast=1.2:gamma=1.3:saturation=1.9, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

gif with eq filter

Seriously, trial and error is how I figured how each works.

e) [optional] Use the colorlevels filter to adjust how bright certain colours are

I use the colorlevels filter to adjust how bright the RGB values are. Most often, I want to reduce how yellow things are (omg, Another Life is so yellow), so I usually adjust the bimax brightness (I totally had to look up the colour wheel to figure this out).

Here’s the default values for the coloverlevels filter:

colorlevels=rimax=1:gimax=1:bimax=1

And here’s the ffmpeg command with this filter:

ffmpeg -ss 00:00:16.974 -to 00:00:18.017 -i [video file] -filter_complex '[0:v] colorlevels=rimax=0.8:gimax=0.95:bimax=0.95, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

gif with colorlevels filter applied

This is another trial and error filter. Slowly adjust each to see how it impacts the overall look. As noted, I’ll adjust bimax to decrease yellow. Adjusting rimax can help give skin a more natural/warm tone (same with saturation on the eq filter—which, on that note, you might have to adjust saturation if you change color levels).

f) [optional] Use gifsicle to change how fast the gif plays.

While you can use ffmpeg for this, I use gifsicle because it’s easy. Here’s how the command looks:

gifsicle -d [delay_time] -b [your awesome gif].gif

Easy! Delay time is in hundredths of a second. Point being, the higher the value the slower it’ll play. One thing to note is that the higher the fps, the less you’ll need to increase the delay time.

gif with all ffmpeg filters and delay adjusted

4. Putting it all together

So… yeah. For most of my gifs, I use all of the filters. The great thing about ffmpeg is that you can do all of this in a single command. Here’s the command I use to make this gif:

gif created by the command

ffmpeg -ss 00:16.974 -to 00:18.017 -i teen_wolf-s04e08-sc1.mp4 -filter_complex '[0:v] fps=15, eq=brightness=0.12:contrast=1.2:gamma=1.3:saturation=1.9, colorlevels=rimax=0.8:gimax=0.95:bimax=0.95, crop=1620:ih:300:50, scale=268:-1:flags=lanczos, smartblur=ls=-1.0, split [a][b];[a] palettegen [p];[b][p] paletteuse' teen_wolf-s04e08-sc1-03.gif

That said… If you don’t want to get into image adjustments or cropping (which is more complicated and time consuming), stick with adjusting the framerate and scaling, with a command like this:

ffmpeg -ss [starting] -to [end] -i [video file] -filter_complex '[0:v] fps=[frames/second], scale=[width]:-1:flags=lanczos, split [a][b];[a] palettegen [p];[b][p] paletteuse' [your awesome gif].gif

gif with scale and framerate adjusted

As you can see, this command will give you a decent looking gif that’s ready for tumblr.

I realize how… complicated and daunting this looks. It’s why I wrote a script to make my life easier. You can always just save the command in a file and copy/paste.

So, um, yeah. This is how I make gifs. I mentioned I wrote a script to automate this in various ways but that command is at the heart of it. I understand that this might not be what you hoped to get since most people I know aren’t super comfortable with the commandline but I honestly found it easier than trying to do it with photoshop—I found the tutorials just as confusing as you (beyond that, I generally just don’t like the program, plus I have to boot windows to use it and bleh).

However… there is a major benefit to using ffmpeg vs photoshop or another GUI.

I mentioned that I don’t save my gifs and instead keep the video clip because it’s smaller. I can do this because I save the timestamps, cropping and scaling dimensions, and adjustments in a spreadsheet. Whenever I want to re-create a gif, I just need to plug the values into that command and voila!, I get the exact same gif. I saw a gif maker the other day post a bunch because they wanted to clear out their drive. Makes sense because gifs take up a lot more space than video (even a high-res one).

I just have a bunch of folders containing a video file and the spreadsheet. This also made it easy for me to write a script to automate a bunch of this. Once I’ve worked my way through a clip and recorded all the relevant data, it takes a single command and no time to regenerate every gif.

Hope this helps!