I made my own version of the scriptthis script, which parameterizes the output resolution and frame rate as well.
Running ./gifenc.sh input.mov output.gif 720 10
will output 720p wide 10fps GIF from the movie you gave it. You might need to do chmod +x gifenc.sh
for the file.
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=$4,scale=$3:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette"
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=$4,scale=$3:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y "$palette"
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$2"
You can read the details on my Github
Assumptions: ffmpeg is installed, and the script is in the same folder as the other files.