Created
June 24, 2019 08:54
-
-
Save PeskyPotato/c9e05f7bb44dfd89a1b512499b684c0e to your computer and use it in GitHub Desktop.
Bash script to make a gif from a section of a video 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
#!/bin/bash | |
scale=640 | |
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] | |
then | |
echo "Arugments <start time> <duration> <file>" | |
fi | |
ffmpeg -ss "$1" -t "$2" -y -i "$3" -vf fps=24,scale="$scale":-1:flags=lanczos,palettegen palette.png | |
ffmpeg -ss "$1" -t "$2" -i "$3" -i palette.png -filter_complex "fps=24,scale="$scale":-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif | |
rm palette.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment