Last active
February 18, 2020 08:07
-
-
Save tucan9389/f0a20ce94e84e42e11d05b55673aacd1 to your computer and use it in GitHub Desktop.
This script converts video to gif by using 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
# Usage: | |
# command | |
# `sh gifconverter.sh /Users/canapio/Desktop/turtle_DEMO_004_4.MP4` | |
# on mac | |
# some configuration | |
width="240" | |
fps="12" | |
# path setup | |
video_path=$1 | |
directory_path=`dirname "$1"` | |
file=`basename "$1"` | |
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment