Created
November 4, 2016 14:51
-
-
Save chrisjrob/e4230ce3b133b7f339f203c3ed40b9a2 to your computer and use it in GitHub Desktop.
Simple script to convert videos to gifs
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 | |
# cnv2gif | |
# Credit for ffmpeg commands to | |
# http://superuser.com/a/556031 | |
if [ "$#" -eq 5 ]; then | |
ffmpeg -y -ss $2 -t $3 -i "$1" -vf fps=$4,scale=320:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -ss $2 -t $3 -i "$1" -i palette.png -filter_complex \ | |
"fps=$4,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" "$5.gif" | |
rm palette.png | |
else | |
echo "Usage: cnv2gif <infile> <delay> <length> <fps> <outfile>.gif" | |
echo "delay is a start delay in integer seconds" | |
echo "length is length in integer seconds" | |
echo "fps is frames per second" | |
echo "e.g. cnv2gif hubble.mp4 1 20 10 hubble" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment