Skip to content

Instantly share code, notes, and snippets.

@peteruithoven peteruithoven/gifenc
Created Sep 22, 2016

Embed
What would you like to do?
#!/bin/bash
# Usage examples:
#
# Create sd.mp4.gif
# $ gifenc sd.mp4
#
# Create sd.gif
# $ gifenc sd.mp4 sd.gif
#
# Create sd.mp4.gif from the 53.8 seconds point, 1.5 seconds long
# $ gifenc sd.mp4 sd.gif -ss 53.8 -t 1.5
palette="/tmp/palette.png"
filters="fps=15,scale=640:-1:flags=lanczos"
inputfile=${1?'supply input file name'}
outputfile=${2-$inputfile.gif}
echo "input: $inputfile"
echo "output: $outputfile"
echo "other arguments: ${@:3}"
ffmpeg -v warning $3 $4 -i "$inputfile" $5 $6 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning $3 $4 -i "$inputfile" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" $5 $6 -y "$outputfile"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.