Skip to content

Instantly share code, notes, and snippets.

@hmnd
Created January 7, 2018 08:27
Show Gist options
  • Save hmnd/1fc1d5fd15f103526e46b28d51ea70e0 to your computer and use it in GitHub Desktop.
Save hmnd/1fc1d5fd15f103526e46b28d51ea70e0 to your computer and use it in GitHub Desktop.
Convert gif to mp4 using ffmpeg
#!/usr/bin/env bash
for f in "$@"
do
case $(file --mime-type -b "$f") in
'image/gif')
echo "${f%.*}"
ffmpeg -f gif -i "$f" -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' "${f%.*}.mp4";;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment