Created
April 11, 2019 22:50
-
-
Save tdhooper/b083be9d024ab25c9a39a0a1c2cba69f to your computer and use it in GitHub Desktop.
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 | |
# From http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html | |
# Usage: | |
# ./makegif.sh export01 output.gif | |
palette="/tmp/palette.png" | |
filters="scale=640:-1:flags=lanczos" | |
frames=`mktemp -d` | |
for i in 1; do | |
for file in $1/*.png; do | |
filename=$(basename "$file") | |
cp $file "$frames/$i-$filename" | |
done | |
done | |
ffmpeg -thread_queue_size 512 -v warning -pattern_type glob -i "$frames/*.png" -vf "$filters,palettegen=stats_mode=diff:max_colors=16" -y $palette | |
ffmpeg -thread_queue_size 512 -v warning -pattern_type glob -i "$frames/*.png" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse=dither=sierra2_4a" -y $2 | |
rm -r $frames |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment