If you're on a mac, and you use cmd+shift+5 to record screens to put in your PR, here's a little snippet i wrote to convert that into a gif:
convertToGif () {
if [ -z "$1" ]; then
mov_filename=$(ls -t ~/Desktop/*.mov | head -n 1)
if [ -z "$mov_filename" ]; then
echo "No MOV files found on the desktop."
return 1
fi
else
mov_filename="$1"
fi
gif_filename="${mov_filename%.*}.gif"
ffmpeg -i "$mov_filename" -pix_fmt rgb8 -r 10 "$gif_filename" && gifsicle -O3 "$gif_filename" -o "$gif_filename"
}
If you provide it a filepath it'll use that (convertToGif <your_recording.mov>
), otherwise if you just say convertToGif
, then it'll pick the latest .mov file from your desktop. Put that in your ~/.zshrc
or ~/.bashrc
file. You'll need to download ffmpeg which actually does the conversion