Skip to content

Instantly share code, notes, and snippets.

@schmich
Last active November 20, 2020 07:33
Show Gist options
  • Save schmich/6ccff06b12bc827ce788a97761ebc241 to your computer and use it in GitHub Desktop.
Save schmich/6ccff06b12bc827ce788a97761ebc241 to your computer and use it in GitHub Desktop.
High quality .gif screen recording on macOS
  • Spotlight > QuickTime Player
  • File > New Screen Recording
  • Click Record, select screen area, click Start Recording
  • Record video, click Stop in macOS toolbar
  • File > Save... > video.mov
  • Run mkgif.sh video.mov 15 400 (15 FPS, 400px width)
  • Output is video.gif
#!/bin/bash
set -euf -o pipefail
file=$1
fps=${2:-15}
width=${3:-400}
out=$(dirname "$file")/$(basename "$file" .mov).gif
ffmpeg -i "$1" -vf "fps=$fps,scale=$width:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i "$1" -i palette.png -filter_complex "fps=$fps,scale=$width:-1:flags=lanczos[x];[x][1:v]paletteuse" "$out"
rm palette.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment