aboutsummaryrefslogtreecommitdiff
path: root/interactive.sh
blob: 425cd257ac386b300c1897bef85c7ecb7842e269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash

set -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/linux_x86_64/release/gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" -o "$output_file_name"