Skip to content

Instantly share code, notes, and snippets.

@hellocatfood
Created January 4, 2015 20:01
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 hellocatfood/9e718566a25c0a84a7ea to your computer and use it in GitHub Desktop.
Save hellocatfood/9e718566a25c0a84a7ea to your computer and use it in GitHub Desktop.
gif to video
#!/bin/bash
for file in *.gif
do
# get filename minus extension
file1=$(basename "$file")
filename="${file1%.*}"
# convert to individual frames with green screen
convert -background "#00AB39" $file -alpha remove -coalesce temp_gif-%04d.png
# convert images to video. Replace avconv with ffmpeg if necessary
avconv -i temp_gif-%04d.png -vcodec mjpeg -q:v 0 "$file".mp4
# clean the directory of temporary images
rm temp_gif*.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment