Skip to content

Instantly share code, notes, and snippets.

@Cobesz
Created September 30, 2022 15:39
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 Cobesz/e101fc653f1ea3405f0290ebe645d24e to your computer and use it in GitHub Desktop.
Save Cobesz/e101fc653f1ea3405f0290ebe645d24e to your computer and use it in GitHub Desktop.
Gnome screenshot tool allows you to record screencasts in webm format. For some usecases (documentation for example) I want to convert this screencast to a gif format so I can easily place it inside other documents. (Markdown files for example as they don't support webm yet).
#!/bin/bash
INPUT="$1"
OUTPUT="$(basename "${INPUT%.*}")"
ffmpeg -i "${INPUT}" \
-vf "fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
-loop -1 \
"${OUTPUT}.gif"
gifsicle --optimize=3 --output "${OUTPUT}-optimized.gif" --resize-height 600 "${OUTPUT}.gif"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment