Skip to content

Instantly share code, notes, and snippets.

@saevarb
Created August 6, 2015 13:11
Show Gist options
  • Save saevarb/9449a4ed6e540c8040c0 to your computer and use it in GitHub Desktop.
Save saevarb/9449a4ed6e540c8040c0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This will not work with set -e because killing ffmpeg means whole script
# ends.
set -xuo pipefail
dorecord() {
local filename="$(date "+%F_%V_%H-%M-%S").webm"
local start="$(date "+%s")"
notify-send "Recording started.."
ffmpeg -f x11grab -s 1366x768 -an -i :0.0 -c:v libvpx -b:v 5M -crf 10 -quality realtime -y -loglevel quiet $filename
scp $filename vps:sbrg/screenshots/$filename
local end="$(date "+%s")"
echo "http://sbrg.me/screenshots/$filename" | xclip -i -sel clipboard
notify-send "Done recording after $((end-start)) seconds"
rm $filename
}
pidof ffmpeg && kill -SIGINT $(pidof ffmpeg) || dorecord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment