Create optimized GIF screencasts on Linux and OSX

It's 2014, animated GIFs are everywhere!

I wanted to be able to add small screencasts to my GitHub projects, because you know,

Back to the future

movies in readme = catch kids attention

Example created with:

gifify back.mp4 -o back.gif --from 01:48:23.200 --to 01:48:25.300 --resize 600:-1 --compress 60 --colors 200 --text "What?..What?What?"  

Unfortunately, GitHub does not allows embedding video files in READMEs.

I searched for tutorials, tools and finally found a solution to create GIF screencasts: build my own tool.

This tutorial will let you generate nice and small GIF screencasts.

GIFs to the rescue!

Record a video file of your screen

Before you can obtain your GIF, you need to generate a video file of your screen. It's not a GIF, it's a regular avi/mp4/mkv etc. Any format.

There are plenty of options for OSX users to record a video of your screen.

On Linux, I use FFcast, there are debian/ubuntu and archlinux packages.

With FFcast, you can select an area and it will record your screen as an mkv movie (by default).

FFcast is a wrapper to FFmpeg, sort of.

Install FFcast.

Then record a movie:

ffcast -s rec  

It will create a screencast.mkv file

Convert your movie into a GIF: Gifify!

Because I couldn't find a great movie to GIF converter, I made one.

It seems to have served a lot of people. It got featured on lifehacker and hackernews homepage, yeepee!

See the Gifify homepage to see how to install it.

Once you have it, turn you screencast into a gif:

gifify screencast.mkv -o screencast.gif  

See the amazing options of gifify:

> gifify -h

  Usage: gifify [options] [file]


    -h, --help              output usage information
    -V, --version           output the version number
    --colors <n>            Number of colors, up to 255, defaults to 80
    --compress <n>          Compression (quality) level, from 0 (no compression) to 100, defaults to 40
    --from <position>       Start position, hh:mm:ss or seconds, defaults to 0
    --fps <n>               Frames Per Second, defaults to 10
    -o, --output <file>     Output file, defaults to stdout
    --resize <W:H>          Resize output, use -1 when specifying only width or height. `350:100`, `400:-1`, `-1:200`
    --speed <n>             Movie speed, defaults to 1
    --subtitles <filepath>  Subtitle filepath to burn to the GIF
    --text <string>         Add some text at the bottom of the movie
    --to <position>         End position, hh:mm:ss or seconds, defaults to end of movie

Have fun with GIFs, but remember:

On modern hardware GIF is the slowest and most expensive video codec. Can we please allow it to be obsoleted?

From My take? YOLO!

comments powered by Disqus