dotfiles/i3/screencast2gif.sh
David Todd accd7763c5 Allow recording to gif
screencast2gif will record a standard `ffcast` (just like pressing
PrtSc) and then ffmpeg will convert it to gif format a short while later
2019-09-11 15:39:52 -05:00

13 lines
460 B
Bash
Executable File

#!/bin/bash
date=$(date +%Y-%m-%d-%s)
ffmpeg() {
command ffmpeg -hide_banner -loglevel error -nostdin "$@"
}
ffcast -q $(while slop -q -n -f '-g %g ';do :;done) rec ~/Videos/screencast-${date}.mp4
ffmpeg -i ~/Videos/screencast-${date}.mp4 -vf palettegen -f image2 -c:v png - |
ffmpeg -i ~/Videos/screencast-${date}.mp4 -i - -filter_complex paletteuse ~/Pictures/screencast-${date}.gif && notify-send "Gif recorded to ~/Pictures/screencast-${date}"