Skip to content

Instantly share code, notes, and snippets.

@y-taka-23
Created August 8, 2021 18:48
Show Gist options
  • Save y-taka-23/241067e8307b6fc9b8c676d026953a25 to your computer and use it in GitHub Desktop.
Save y-taka-23/241067e8307b6fc9b8c676d026953a25 to your computer and use it in GitHub Desktop.
A script for converting mov to gif
#!/bin/bash
rm -f cut.mov
rm -f palette.png
rm -f encoded.gif
rm -f output.gif
ffmpeg -ss 10 -to 15 -i input.mov -c copy cut.mov
ffmpeg -i cut.mov -vf fps=30,scale=340:-1:flags=lanczos,palettegen palette.png
ffmpeg -i cut.mov -i palette.png -filter_complex "fps=30,scale=340:-1:flags=lanczos[x];[x][1:v]paletteuse" encoded.gif
gifsicle -O3 --colors=16 --lossy=30 output.gif -o output.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment