Skip to content

Instantly share code, notes, and snippets.

@alioguzhan
Created May 19, 2016 12:56
Embed
What would you like to do?
Bash script to create gif from vide with ffmpeg
#!/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