summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
authorShaw <eastwoodshaw@gmail.com>2020-11-14 20:10:19 +0000
committerGitHub <noreply@github.com>2020-11-14 15:10:19 -0500
commit3215e7b4bb25f04db9caa4677caf32899de3e4c9 (patch)
tree811fcfcbc0b2f0e272e8c4a320b0a5e38e1cae4e /.local
parent11d4f16fb4c34834b1023c1ec808094dbca69d7b (diff)
downloadeibhear-3215e7b4bb25f04db9caa4677caf32899de3e4c9.tar.gz
eibhear-3215e7b4bb25f04db9caa4677caf32899de3e4c9.tar.zst
eibhear-3215e7b4bb25f04db9caa4677caf32899de3e4c9.zip
Add video selection to dmenurecord (#825)
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/dmenurecord20
1 files changed, 19 insertions, 1 deletions
diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord
index 49a2fbf..b1a034a 100755
--- a/.local/bin/dmenurecord
+++ b/.local/bin/dmenurecord
@@ -80,11 +80,12 @@ audio() { \
}
askrecording() { \
- choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
+ choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast;;
audio) audio;;
video) video;;
+ *selected) videoselected;;
webcam) webcam;;
"webcam (hi-def)") webcamhidef;;
esac
@@ -95,11 +96,28 @@ asktoend() { \
[ "$response" = "Yes" ] && killrecording
}
+videoselected()
+{
+ slop -f "%x %y %w %h" > /tmp/slop
+ read -r X Y W H < /tmp/slop
+ rm /tmp/slop
+
+ ffmpeg \
+ -f x11grab \
+ -framerate 60 \
+ -video_size "$W"x"$H" \
+ -i :0.0+"$X,$Y" \
+ -c:v libx264 -qp 0 -r 30 \
+ "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
+ echo $! > /tmp/recordingpid
+ updateicon "⏺️"
+}
case "$1" in
screencast) screencast;;
audio) audio;;
video) video;;
+ *selected) videoselected;;
kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac