From d4bc7b420ec258040f8f36234d7f2b08f2dd1c38 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 22 Mar 2022 13:04:08 +0100 Subject: [PATCH] Add script to record the selected window (with the active audio device) --- TODO | 1 + project.conf | 2 +- record-selected.sh | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 record-selected.sh diff --git a/TODO b/TODO index f276aa8..f2abf1c 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,7 @@ Check for reparent. Only add window to list if its the window is a topmost window. Use nvEncoder api directly? maybe with this we could copy the window opengl texture directly to the gpu which doesn't work right now for some reason. Right now we are required to copy the opengl texture to another opengl texture first. + nvEncRegisterResource allows registering an opengl texture directly with NV_ENC_INPUT_RESOURCE_OPENGL_TEX and using that directly in the encoding. Load cuda at runtime with dlopen. Track window damages and only update then. That is better for output file size. Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way. diff --git a/project.conf b/project.conf index 882e1d5..03c74fb 100644 --- a/project.conf +++ b/project.conf @@ -6,7 +6,7 @@ platforms = ["posix"] [config] include_dirs = ["/opt/cuda/targets/x86_64-linux/include"] -libs = ["/usr/lib/libcuda.so"] +libs = ["/usr/lib64/libcuda.so"] [define] PULSEAUDIO = "1" diff --git a/record-selected.sh b/record-selected.sh new file mode 100755 index 0000000..5782ac3 --- /dev/null +++ b/record-selected.sh @@ -0,0 +1,8 @@ +#!/bin/sh -e + +window=$(xdotool selectwindow) +active_sink="$(pactl get-default-sink).monitor" +mkdir -p "$HOME/Videos" +video="$HOME/Videos/$(date +"Video_%Y-%m-%d_%H-%M-%S.mp4")" +gpu-screen-recorder -w "$window" -c mp4 -f 60 -a "${active_sink}.monitor" -o "$video" +notify-send "GPU Screen Recorder" "Saved video to $video"