Skip to content

Instantly share code, notes, and snippets.

@ryanlerch
Created May 1, 2014 14:47
Show Gist options
  • Save ryanlerch/7fa82e32898f68410bd5 to your computer and use it in GitHub Desktop.
Save ryanlerch/7fa82e32898f68410bd5 to your computer and use it in GitHub Desktop.
Generates an Animated GIF from a webm
#!/bin/bash
echo "$1"
mkdir /tmp/"$1"/
gst-launch-1.0 filesrc location="$1" ! decodebin ! videoconvert ! pngenc ! multifilesink location="/tmp/$1/%04d.png"
echo "Trim files manually, and press enter to generate the GIF"
nautilus /tmp/"$1"/ &
read
echo "Generating GIF..."
convert -delay 5 /tmp/"$1"/*.png /tmp/"$1"/animation.gif
echo "Before:"
du -h /tmp/"$1"/animation.gif
convert /tmp/"$1"/animation.gif -fuzz 5% -layers Optimize /tmp/"$1"/result.gif
echo "After:"
du -h /tmp/"$1"/result.gif
eog /tmp/"$1"/result.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment