Skip to content

Instantly share code, notes, and snippets.

@acgourley
Created September 22, 2016 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acgourley/18a8b9677b975ab1410e69e20a19c7c7 to your computer and use it in GitHub Desktop.
Save acgourley/18a8b9677b975ab1410e69e20a19c7c7 to your computer and use it in GitHub Desktop.
This script will use the https://github.com/fogleman/primitive library to create an abstract one second animation of the input image.
#!/bin/sh
palette="/tmp/palette.png"
fps=8
filters="fps="$fps",scale=600:-2:flags=lanczos"
for i in `seq 1 $fps`;
do
echo starting image $i
sem --id prim$1 -j+0 ~/go/bin/primitive -i $1 -o $1.0$i.png -n $2 -m $3
done
sem --id prim$1 --wait
ffmpeg -y -framerate $fps -i $1.%02d.png -c:v libx264 -r $fps -pix_fmt yuv420p -crf 10 $1.mp4
ffmpeg -v warning -i $1.mp4 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1.mp4 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $1.$2_$3.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment