Last active
July 29, 2019 06:57
-
-
Save saiday/60b4917b74d7a77d9106406d2ee85f2f to your computer and use it in GitHub Desktop.
convert mp4 video to gif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dependencies: | |
# - ffmpeg | |
# - imagemagick | |
# Usage: | |
mkdir mp4_to_gif | |
ffmpeg -i myfile.mp4 -vf scale=1024:-1:flags=lanczos,fps=10 mp4_to_gif/ffout%03d.png | |
convert -loop 0 mp4_to_gif/ffout*.png output.gif | |
rm -rf mp4_to_gif | |
# CLI shorthand: | |
# video to gif | |
alias v2g='function _v2g(){ mkdir mp4_to_gif && ffmpeg -i $1 -vf scale=420:-1:flags=lanczos,fps=10 mp4_to_gif/ffout%03d.png && echo "converting gif ..." && convert -loop 0 mp4_to_gif/ffout*.png output.gif && rm -rf mp4_to_gif };_v2g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment