Skip to content

Instantly share code, notes, and snippets.

@fedir
Last active November 22, 2018 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedir/56aeddde59571402a0d94f78eb6c7a5c to your computer and use it in GitHub Desktop.
Save fedir/56aeddde59571402a0d94f78eb6c7a5c to your computer and use it in GitHub Desktop.
Convert OGV to GIF
INPUT_FILE=$1
FPS=15
WIDTH=320
TEMP_FILE_PATH="~/tmp.png"
ffmpeg -i $INPUT_FILE -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen $TEMP_FILE_PATH
ffmpeg -i $INPUT_FILE -i $TEMP_FILE_PATH -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" $INPUT_FILE.gif
rm $TEMP_FILE_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment