Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active January 31, 2020 16:27
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 RichardBronosky/d9c80100ac7c9b1e76fbde1adf8e768b to your computer and use it in GitHub Desktop.
Save RichardBronosky/d9c80100ac7c9b1e76fbde1adf8e768b to your computer and use it in GitHub Desktop.
A growing collection of ffmpeg tools to convert (Quicktime and other) videos to gif or other optimized formats
#!/usr/bin/env bash -eu
# Usage: ffmpeg_chat.sh input.mov [output.mp4]
# from: https://andrekr.github.io/ffmpeg-command-line-wizard/
ffmpeg -hide_banner -i "$1" -c:v libx264 -preset medium -movflags faststart -vsync 2 -enc_time_base -1 -crf 23 "${2:-${1/\.[^.]*/}.mp4}"
#!/usr/bin/env bash
# Usage: gifenc.sh input.mov [output.gif]
# from: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
palette="/tmp/palette.png"
filters="fps=5"
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:-${1/\.[^.]*/}.gif}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment