-
-
Save vayn/2ef2589944907e3ef8852644238e8d28 to your computer and use it in GitHub Desktop.
convert 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
#!/bin/sh | |
# Convert video to gif. | |
if [[ $# -ne 3 ]]; then | |
echo "Usage: trans_gif source.mp4 target.gif 300" | |
exit 1 | |
fi | |
palette="/tmp/palette.png" | |
filters="fps=15,scale=$3:-1:flags=lanczos" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment