Last active
April 1, 2022 12:07
-
-
Save cachapa/aa829bfc717fc4f1d52c568d7ae8521e to your computer and use it in GitHub Desktop.
Shell script to generate high-quality animated gifs from a video file
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
#!/bin/bash | |
# Based on http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html | |
# Requires ffmpeg | |
filename="${1%.*}" | |
palette="/tmp/palette.png" | |
filters="scale=320:-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 "$filename.gif" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment