aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-02-28 18:34:01 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-02-28 18:34:01 +0100
commitb8f2c418238af1b784b160d70bc60e4f3d2a61f3 (patch)
tree485a53a71ce0da654b2c68fdd6746a3f502bb317
parente7d59e49793442481705f0a8bb1d24ccea30eb8f (diff)
downloadscripts-b8f2c418238af1b784b160d70bc60e4f3d2a61f3.tar.gz
scripts-b8f2c418238af1b784b160d70bc60e4f3d2a61f3.zip
Created screen recording scripts.
-rwxr-xr-xgetResolution.sh3
-rwxr-xr-xi3blocks/i3rec.sh13
-rwxr-xr-xscreenRecord.sh15
-rwxr-xr-xstopScreenRecord.sh15
4 files changed, 46 insertions, 0 deletions
diff --git a/getResolution.sh b/getResolution.sh
new file mode 100755
index 0000000..5f81333
--- /dev/null
+++ b/getResolution.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+xrandr | grep '*' | awk '{print $1}'
diff --git a/i3blocks/i3rec.sh b/i3blocks/i3rec.sh
new file mode 100755
index 0000000..82fede7
--- /dev/null
+++ b/i3blocks/i3rec.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Shows status of ffmpeg screen recording
+
+#case $BLOCK_BUTTON in
+# 1) # Left click
+# 2) # Middle click
+# 3) # Right click
+#esac
+
+MARKFILE='/tmp/screenRec.mark'
+[ -e $MARKFILE ] && echo "🎥✔️" && exit 0
+echo ""
diff --git a/screenRecord.sh b/screenRecord.sh
new file mode 100755
index 0000000..710d47e
--- /dev/null
+++ b/screenRecord.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+MARKFILE='/tmp/screenRec.mark'
+# Check if already recording
+if [ -e $MARKFILE ]; then
+ stopScreenRecord.sh
+else
+ touch $MARKFILE
+ filename=rec"$(date +"%y-%m-%d_%H-%M-%S")".mp4
+ # also record microphone
+ # ffmpeg -video_size "$(getResolution.sh)" -framerate 30 -f x11grab -i :0.0+0,0 -f alsa -ac 2 -i hw:0,0 "$HOME/videos/recs/$filename" &
+ ffmpeg -video_size "$(getResolution.sh)" -framerate 30 -f x11grab -i :0.0+0,0 "$HOME/videos/recs/$filename" &
+ notify-send -t 1000 "Recording $filename"
+ pkill -SIGRTMIN+13 i3blocks
+fi
diff --git a/stopScreenRecord.sh b/stopScreenRecord.sh
new file mode 100755
index 0000000..680f2f4
--- /dev/null
+++ b/stopScreenRecord.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+MARKFILE='/tmp/screenRec.mark'
+# Terminate ffmpeg processes
+for process in $(pgrep -x ffmpeg)
+do
+ kill "$process" && notify-send -t 1000 "ffmpeg $process stopped."
+done
+# Terminate screenRecord.sh processes
+for process in $(pgrep -x screenRecord.sh)
+do
+ kill "$process" && notify-send -t 1000 "Recording $process stopped."
+done
+rm $MARKFILE
+pkill -SIGRTMIN+13 i3blocks