Created
September 2, 2016 14:00
-
-
Save calvarez-ov/38bb735b97f5d01757075d6f551b870c to your computer and use it in GitHub Desktop.
mp4 to animated gif with brief blank screen between loops
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
inputfile=$1 | |
ffmpeg -y -i $inputfile -vf fps=10,scale=320:-1:flags=lanczos,palettegen /tmp/palette.png | |
ffmpeg -i $inputfile -i /tmp/palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" /tmp/temp.gif | |
convert /tmp/temp.gif -alpha Opaque +level-colors Black -flatten /tmp/black.png | |
convert /tmp/temp.gif -delay 50 /tmp/black.png /tmp/output.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
bash mp42gif.bash /path/to/video.mp4
This produces an animated gif in
/tmp/output.gif