Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Create a d.o compatible mini movie gif rather than a static screenshot
#!/bin/sh
# Create an animated GIF of a screen recording to upload to d.o
# Usage: creategif input_file.mp4 output_file.gif
# As described at http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
palette="/tmp/palette.png"
filters="fps=15,scale=1280:-1:flags=lanczos"
# GIF supports a 256 colour palette. Determine the best palette and store as temp file
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
# Use the stored palette to encode the GIF
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
Owner

rachellawson commented May 30, 2015

You'll need to install ffmpeg (Mac: brew install ffmpeg) and have this script somewhere handy.

Use the QuickTime app on your Mac to record a screen recording and then save as a file somewhere - mp4 format is good.

Put this script in /usr/local/bin and run it on the file which will give you a gif file to upload to d.o BUT CHECK HOW BIG IT IS before uploading!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment