Last active
November 29, 2020 04:35
-
-
Save clearxlate/4bbf5ae5ff26ebfc9c2cc9876ac29da6 to your computer and use it in GitHub Desktop.
Create animated gif from video
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
# Convert video to gif file. | |
# Usage: video2gif video_file (scale) (fps) | |
video2gif() { | |
ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png" | |
ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".> | |
rm "${1}.png" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment