aboutsummaryrefslogtreecommitdiff
path: root/interactive.sh
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-04-04 14:54:12 +0200
committerdec05eba <dec05eba@protonmail.com>2020-06-21 14:41:11 +0200
commitf9e99e57f9c193e70ca4abf5f33aa4f112b13e89 (patch)
treeea4a3b10ccf383d8c88817ac1c27fc36248f2fe8 /interactive.sh
parent4418871737701ff4d966e6dc33e68c175c58d2dd (diff)
Add interactive record script
Diffstat (limited to 'interactive.sh')
-rwxr-xr-xinteractive.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/interactive.sh b/interactive.sh
new file mode 100755
index 0000000..54a4d62
--- /dev/null
+++ b/interactive.sh
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+
+print_selected_window_id() {
+ xwininfo | grep 'Window id:' | cut -d' ' -f4
+}
+
+echo "Select a window to record"
+window_id=$(print_selected_window_id)
+
+echo -n "Enter video fps: "
+read fps
+
+echo "Select audio input:"
+selected_audio_input=""
+select audio_input in $(pactl list | sed -rn 's/Monitor Source: (.*)/\1/p'); do
+ if [ "$audio_input" == "" ]; then
+ echo "Invalid option $REPLY"
+ else
+ selected_audio_input="$audio_input"
+ break
+ fi
+done
+
+echo -n "Enter output file name: "
+read output_file_name
+
+output_dir=$(dirname "$output_file_name")
+mkdir -p "$output_dir"
+
+sibs build --release && ./sibs-build/linux_x86_64/release/gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" > "$output_file_name"