aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/interactive.sh4
-rwxr-xr-xscripts/record-application-name.sh6
-rwxr-xr-xscripts/record-save-application-name.sh14
-rwxr-xr-xscripts/replay-application-name.sh6
-rwxr-xr-xscripts/replay.sh6
-rwxr-xr-xscripts/save-recording.sh3
-rwxr-xr-xscripts/save-replay.sh3
-rwxr-xr-xscripts/start-recording.sh5
-rwxr-xr-xscripts/start-replay.sh3
-rwxr-xr-xscripts/start-stop-recording.sh10
-rwxr-xr-xscripts/toggle-recording-selected.sh6
-rwxr-xr-xscripts/twitch-stream-local-copy.sh4
-rwxr-xr-xscripts/twitch-stream.sh4
-rwxr-xr-xscripts/youtube-hls-stream.sh10
14 files changed, 57 insertions, 27 deletions
diff --git a/scripts/interactive.sh b/scripts/interactive.sh
index 63b0eae..bfaaae0 100755
--- a/scripts/interactive.sh
+++ b/scripts/interactive.sh
@@ -1,7 +1,5 @@
#!/bin/sh -e
-selected_audio_input="$(pactl get-default-sink).monitor"
-
echo "Select a window to record"
window_id=$(xdotool selectwindow)
@@ -14,4 +12,4 @@ read output_file_name
output_dir=$(dirname "$output_file_name")
mkdir -p "$output_dir"
-gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a "$selected_audio_input" -o "$output_file_name"
+gpu-screen-recorder -w "$window_id" -c mp4 -f "$fps" -a default_output -o "$output_file_name"
diff --git a/scripts/record-application-name.sh b/scripts/record-application-name.sh
new file mode 100755
index 0000000..f8c9b0d
--- /dev/null
+++ b/scripts/record-application-name.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+window=$(xdotool selectwindow)
+window_name=$(xdotool getwindowname "$window" || xdotool getwindowclassname "$window" || echo "Game")
+window_name="$(echo "$window_name" | tr '/\\' '_')"
+gpu-screen-recorder -w "$window" -f 60 -a default_output -o "$HOME/Videos/recording/$window_name/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")"
diff --git a/scripts/record-save-application-name.sh b/scripts/record-save-application-name.sh
new file mode 100755
index 0000000..c95f398
--- /dev/null
+++ b/scripts/record-save-application-name.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# This script should be passed to gpu-screen-recorder with the -sc option, for example:
+# gpu-screen-recorder -w screen -f 60 -a default_output -r 60 -sc scripts/record-save-application-name.sh -c mp4 -o "$HOME/Videos"
+
+window=$(xdotool getwindowfocus)
+window_name=$(xdotool getwindowname "$window" || xdotool getwindowclassname "$window" || echo "Game")
+window_name="$(echo "$window_name" | tr '/\\' '_')"
+
+video_dir="$HOME/Videos/Replays/$window_name"
+mkdir -p "$video_dir"
+video="$video_dir/$(date +"${window_name}_%Y-%m-%d_%H-%M-%S.mp4")"
+mv "$1" "$video"
+sleep 0.5 && notify-send -t 2000 -u low "GPU Screen Recorder" "Replay saved to $video" \ No newline at end of file
diff --git a/scripts/replay-application-name.sh b/scripts/replay-application-name.sh
new file mode 100755
index 0000000..3c3f8c5
--- /dev/null
+++ b/scripts/replay-application-name.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+window=$(xdotool selectwindow)
+window_name=$(xdotool getwindowname "$window" || xdotool getwindowclassname "$window" || echo "Game")
+window_name="$(echo "$window_name" | tr '/\\' '_')"
+gpu-screen-recorder -w "$window" -f 60 -c mkv -a default_output -bm cbr -q 40000 -r 60 -o "$HOME/Videos/Replays/$window_name"
diff --git a/scripts/replay.sh b/scripts/replay.sh
deleted file mode 100755
index cf6c494..0000000
--- a/scripts/replay.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh -e
-
-[ "$#" -ne 4 ] && echo "usage: replay.sh <window_id> <fps> <replay_time_sec> <output_directory>" && exit 1
-active_sink="$(pactl get-default-sink).monitor"
-mkdir -p "$4"
-gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$active_sink" -r "$3" -o "$4"
diff --git a/scripts/save-recording.sh b/scripts/save-recording.sh
new file mode 100755
index 0000000..90fefc1
--- /dev/null
+++ b/scripts/save-recording.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+killall -SIGINT gpu-screen-recorder && sleep 0.5 && notify-send -t 1500 -u low "GPU Screen Recorder" "Recording saved"
diff --git a/scripts/save-replay.sh b/scripts/save-replay.sh
index eac9141..f9390aa 100755
--- a/scripts/save-replay.sh
+++ b/scripts/save-replay.sh
@@ -1,4 +1,3 @@
#!/bin/sh -e
-killall -SIGUSR1 gpu-screen-recorder
-notify-send -t 5000 -u low -- "GPU Screen Recorder" "Replay saved"
+killall -SIGUSR1 gpu-screen-recorder && sleep 0.5 && notify-send -t 1500 -u low -- "GPU Screen Recorder" "Replay saved"
diff --git a/scripts/start-recording.sh b/scripts/start-recording.sh
new file mode 100755
index 0000000..03fda73
--- /dev/null
+++ b/scripts/start-recording.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+pidof -q gpu-screen-recorder && exit 0
+video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")"
+gpu-screen-recorder -w screen -f 60 -a default_output -o "$video"
diff --git a/scripts/start-replay.sh b/scripts/start-replay.sh
index 29ff67a..d47a614 100755
--- a/scripts/start-replay.sh
+++ b/scripts/start-replay.sh
@@ -1,5 +1,6 @@
#!/bin/sh
+pidof -q gpu-screen-recorder && exit 0
video_path="$HOME/Videos"
mkdir -p "$video_path"
-gpu-screen-recorder -w screen -f 60 -a "$(pactl get-default-sink).monitor" -c mp4 -r 30 -o "$video_path"
+gpu-screen-recorder -w screen -f 60 -a default_output -c mkv -bm cbr -q 40000 -r 30 -o "$video_path"
diff --git a/scripts/start-stop-recording.sh b/scripts/start-stop-recording.sh
new file mode 100755
index 0000000..775a829
--- /dev/null
+++ b/scripts/start-stop-recording.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Simple script to start recording if it's not recording and stop recording
+# if it's already recording. This script can be bound to a single hotkey
+# to start/stop recording with a single hotkey.
+
+killall -SIGINT -q gpu-screen-recorder && exit 0
+video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")"
+gpu-screen-recorder -w screen -f 60 -a default_output -o "$video"
+notify-send -t 2000 -u low "GPU Screen Recorder" "Video saved to $video"
diff --git a/scripts/toggle-recording-selected.sh b/scripts/toggle-recording-selected.sh
index f87f71c..d4c1b38 100755
--- a/scripts/toggle-recording-selected.sh
+++ b/scripts/toggle-recording-selected.sh
@@ -1,9 +1,9 @@
#!/bin/sh -e
-killall -INT gpu-screen-recorder && notify-send -u low 'GPU Screen Recorder' 'Stopped recording' && exit 0;
+killall -SIGINT gpu-screen-recorder && sleep 0.5 && notify-send -t 1500 -u low 'GPU Screen Recorder' 'Stopped recording' && exit 0;
window=$(xdotool selectwindow)
-active_sink="$(pactl get-default-sink).monitor"
+active_sink=default_output
mkdir -p "$HOME/Videos"
video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")"
-notify-send -t 5000 -u low 'GPU Screen Recorder' "Started recording video to $video"
+notify-send -t 1500 -u low 'GPU Screen Recorder' "Started recording video to $video"
gpu-screen-recorder -w "$window" -c mp4 -f 60 -a "$active_sink" -o "$video"
diff --git a/scripts/twitch-stream-local-copy.sh b/scripts/twitch-stream-local-copy.sh
index dba9d15..fa23cf6 100755
--- a/scripts/twitch-stream-local-copy.sh
+++ b/scripts/twitch-stream-local-copy.sh
@@ -3,5 +3,5 @@
# Stream on twitch while also saving the video to disk locally
[ "$#" -ne 4 ] && echo "usage: twitch-stream-local-copy.sh <window_id> <fps> <livestream_key> <local_file>" && exit 1
-active_sink="$(pactl get-default-sink).monitor"
-gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" | tee -- "$4" | ffmpeg -i pipe:0 -c copy -f flv -- "rtmp://live.twitch.tv/app/$3"
+active_sink=default_output
+gpu-screen-recorder -w "$1" -c flv -f "$2" -q high -a "$active_sink" | tee -- "$4" | ffmpeg -i pipe:0 -c copy -f flv -- "rtmp://live.twitch.tv/app/$3"
diff --git a/scripts/twitch-stream.sh b/scripts/twitch-stream.sh
index cd4737a..99dade8 100755
--- a/scripts/twitch-stream.sh
+++ b/scripts/twitch-stream.sh
@@ -1,5 +1,5 @@
#!/bin/sh
[ "$#" -ne 3 ] && echo "usage: twitch-stream.sh <window_id> <fps> <livestream_key>" && exit 1
-active_sink="$(pactl get-default-sink).monitor"
-gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$active_sink" -o "rtmp://live.twitch.tv/app/$3"
+active_sink=default_output
+gpu-screen-recorder -w "$1" -c flv -f "$2" -q high -a "$active_sink" -o "rtmp://live.twitch.tv/app/$3"
diff --git a/scripts/youtube-hls-stream.sh b/scripts/youtube-hls-stream.sh
index 21619af..10fa6b2 100755
--- a/scripts/youtube-hls-stream.sh
+++ b/scripts/youtube-hls-stream.sh
@@ -1,11 +1,5 @@
#!/bin/sh
[ "$#" -ne 3 ] && echo "usage: youtube-hls-stream.sh <window_id> <fps> <livestream_key>" && exit 1
-mkdir "youtube_stream"
-cd "youtube_stream"
-active_sink="$(pactl get-default-sink).monitor"
-gpu-screen-recorder -w "$1" -c mpegts -f "$2" -a "$active_sink" | ffmpeg -i pipe:0 -c copy -f hls \
- -hls_time 2 -hls_flags independent_segments -hls_flags delete_segments -hls_segment_type mpegts -hls_segment_filename stream%02d.ts -master_pl_name stream.m3u8 out1 &
-echo "Waiting until stream segments are created..."
-sleep 10
-ffmpeg -i stream.m3u8 -c copy -- "https://a.upload.youtube.com/http_upload_hls?cid=$3&copy=0&file=stream.m3u8"
+active_sink=default_output
+gpu-screen-recorder -w "$1" -c hls -f "$2" -q high -a "$active_sink" -ac aac -o "https://a.upload.youtube.com/http_upload_hls?cid=$3&copy=0&file=stream.m3u8" \ No newline at end of file