Created
September 11, 2022 07:43
-
-
Save YuanLiou/77432b769de277dfa1917317302652bd to your computer and use it in GitHub Desktop.
FFMPEG convert video to gif
This file contains hidden or 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}".gif | |
rm "${1}.png" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment