Created
May 19, 2016 12:56
-
-
Save alioguzhan/3cc7a032ffce692ab386f7f3ad00c09d to your computer and use it in GitHub Desktop.
Bash script to create gif from vide 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
#!/bin/sh | |
global_palette="/tmp/global_palette.png" | |
filters="fps=$5,scale=$6:-1:flags=lanczos" | |
ffmpeg -v error -ss $1 -t $2 -i $3 -vf "$filters,palettegen" -y $global_palette | |
ffmpeg -v error -ss $1 -t $2 -i $3 -i $global_palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $4 | |
# Example Usage: | |
# start duration input file output file fps gif scale | |
# ----- -------- ---------- ----------- --- --------- | |
# ./gif.sh 00:30 10 input.mp4 output.gif 20 260 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment