From 2cd031db48272635b851d6c79a6f283e497293d1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 11 May 2024 23:03:10 +0200 Subject: Add -sc example script to save the replay video to a folder with the game name --- scripts/record-save-application-name.sh | 14 ++++++++++++++ scripts/replay-application-name.sh | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 scripts/record-save-application-name.sh (limited to 'scripts') diff --git a/scripts/record-save-application-name.sh b/scripts/record-save-application-name.sh new file mode 100755 index 0000000..c002376 --- /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 "$(pactl get-default-sink).monitor" -r 60 -sc scripts/record-save-application-name.sh -c mp4 -o "$HOME/Videos" + +window=$(xdotool getwindowfocus) +window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$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 index 826ca3b..7683abb 100755 --- a/scripts/replay-application-name.sh +++ b/scripts/replay-application-name.sh @@ -3,4 +3,4 @@ window=$(xdotool selectwindow) window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$window" || echo "game") window_name="$(echo "$window_name" | tr '/\\' '_')" -gpu-screen-recorder -w "$window" -f 60 -c mkv -a "$(pactl get-default-sink).monitor" -r 60 -o "$HOME/Videos/replay/$window_name" +gpu-screen-recorder -w "$window" -f 60 -c mkv -a "$(pactl get-default-sink).monitor" -r 60 -o "$HOME/Videos/Replays/$window_name" -- cgit v1.2.3