Last active
September 1, 2015 13:07
-
-
Save rachellawson/3168e8abeca9b46ff30b to your computer and use it in GitHub Desktop.
Create a d.o compatible mini movie gif rather than a static screenshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!!