Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Created April 28, 2021 15:16
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 thetwopct/ccc0f985bc7f4721d7557a916ce82145 to your computer and use it in GitHub Desktop.
Save thetwopct/ccc0f985bc7f4721d7557a916ce82145 to your computer and use it in GitHub Desktop.
Convert animated GIFs to lightweight MP4 videos
# navigate to folder with gifs in it, then run this at CLI
# qulity is controlled by -b:v - lower the number the worse the quality
for i in *.gif;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -b:v 250K "${name}.mp4"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment