Created
March 10, 2020 06:30
-
-
Save tucan9389/5984e4a55e3ed0a44468530a20927d42 to your computer and use it in GitHub Desktop.
convert videos to gifs with ffmpeg
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
width="400" | |
fps="12" | |
for path in "$@" | |
do | |
echo "$path" | |
# path setup | |
video_path=$path | |
directory_path=`dirname "$path"` | |
file=`basename "$path"` | |
extension="${file##*.}" | |
filename="${file%.*}" | |
echo $extension | |
gif_path="${video_path%.*}.gif" | |
echo $gif_path | |
ffmpeg -y -i $video_path -vf fps=$fps,scale=$width:-1:flags=lanczos,palettegen palette.png; | |
ffmpeg -y -i $video_path -i palette.png -filter_complex "fps=$fps,scale=$width:-1:flags=lanczos[x];[x][1:v]paletteuse" $gif_path; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment