Add screencast script
authorSiraaj Khandkar <siraaj@khandkar.net>
Wed, 31 Aug 2022 21:40:03 +0000 (17:40 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Wed, 31 Aug 2022 21:40:03 +0000 (17:40 -0400)
home/bin/screencast [new file with mode: 0755]

diff --git a/home/bin/screencast b/home/bin/screencast
new file mode 100755 (executable)
index 0000000..4597820
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+set -o pipefail
+
+DIR=~/arc/vid/screencasts
+EXT=mkv
+#EXT=ogv # Low quality for some reason
+
+main() {
+    local -r timestamp=$(date +'%Y-%m-%d--%H-%M-%S') || exit 1
+    local -r file_name="screen--${timestamp}.$EXT"
+    local -r file_path="$DIR"/"$file_name"
+    local -r slop=$(slop -f '%x %y %w %h') || exit 1
+
+    mkdir -p "$DIR"
+    read -r X Y W H <<< "$slop"
+    ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+"$X","$Y" -f pulse -ac 2 -i default "$file_path"
+}
+
+main "$@"
This page took 0.030211 seconds and 4 git commands to generate.