From 03e583e61e4cc28fa614dcd981d093ede0b3dd62 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 27 Feb 2023 16:33:29 +0100 Subject: Add replay scripts --- README.md | 5 ++++- scripts/save-replay.sh | 4 ++++ scripts/start-replay.sh | 5 +++++ scripts/stop-replay.sh | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100755 scripts/save-replay.sh create mode 100755 scripts/start-replay.sh create mode 100755 scripts/stop-replay.sh diff --git a/README.md b/README.md index 6e7f9a8..6d16de4 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ You can also install gpu screen recorder ([the gtk gui version](https://git.dec0 # How to use Run `scripts/interactive.sh` or run gpu-screen-recorder directly, for example: `gpu-screen-recorder -w $(xdotool selectwindow) -c mp4 -f 60 -a "$(pactl get-default-sink).monitor" -o test_video.mp4` then stop the screen recorder with Ctrl+C, which will also save the recording. You can change -w to -w screen if you want to record all monitors or if you want to record a specific monitor then you can use -w monitor-name, for example -w HDMI-0 (use xrandr command to find the name of your monitor. The name can also be found in your desktop environments display settings).\ -Send signal SIGUSR1 (`killall -SIGUSR1 gpu-screen-recorder`) to gpu-screen-recorder when in replay mode to save the replay. The paths to the saved files is output to stdout after the recording is saved.\ +Send signal SIGUSR1 (`killall -SIGUSR1 gpu-screen-recorder`) to gpu-screen-recorder when in replay mode to save the replay. The paths to the saved files is output to stdout after the recording is saved (note that all other text it output to stderr so you can ignore that text).\ You can find the default output audio device (headset, speakers (in other words, desktop audio)) with the command `pactl get-default-sink`. Add `monitor` to the end of that to use that as an audio input in gpu-screen-recorder.\ You can find the default input audio device (microphone) with the command `pactl get-default-source`. This input should not have `monitor` added to the end when used in gpu-screen-recorder.\ Example of recording both desktop audio and microphone: `gpu-screen-recorder -w $(xdotool selectwindow) -c mp4 -f 60 -a "$(pactl get-default-sink).monitor" -a "$(pactl get-default-source)" -o test_video.mp4`.\ @@ -39,6 +39,9 @@ Note that if you use multiple audio inputs then they are each recorded into sepa for example -a "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor|bluez_0012.monitor". There is also a gui for the gpu-screen-recorder called [gpu-screen-recorder-gtk](https://git.dec05eba.com/gpu-screen-recorder-gtk/). +## Simple way to run replay without gui +Run the script `scripts/start-replay.sh` to start replay and then `scripts/save-replay.sh` to save a replay and `scripts/stop-replay.sh` to stop the replay. The videos are saved to `$HOME/Videos`. +You can use these scripts to start replay at system startup if you add `scripts/start-replay.sh` to startup (this can be done differently depending on your desktop environment / window manager) and then go into hotkey settings on your system and choose a hotkey to run the script `scripts/save-replay.sh`. Modify `scripts/start-replay.sh` if you want to use other replay options. # Demo [![Click here to watch a demo video on youtube](https://img.youtube.com/vi/n5tm0g01n6A/0.jpg)](https://www.youtube.com/watch?v=n5tm0g01n6A) diff --git a/scripts/save-replay.sh b/scripts/save-replay.sh new file mode 100755 index 0000000..eac9141 --- /dev/null +++ b/scripts/save-replay.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e + +killall -SIGUSR1 gpu-screen-recorder +notify-send -t 5000 -u low -- "GPU Screen Recorder" "Replay saved" diff --git a/scripts/start-replay.sh b/scripts/start-replay.sh new file mode 100755 index 0000000..29ff67a --- /dev/null +++ b/scripts/start-replay.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +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" diff --git a/scripts/stop-replay.sh b/scripts/stop-replay.sh new file mode 100755 index 0000000..d38da9c --- /dev/null +++ b/scripts/stop-replay.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +killall -SIGINT gpu-screen-recorder -- cgit v1.2.3