Add script to record the selected window (with the active audio device)

This commit is contained in:
dec05eba 2022-03-22 13:04:08 +01:00
parent f81bdfb29e
commit d4bc7b420e
3 changed files with 10 additions and 1 deletions

1
TODO
View File

@ -2,6 +2,7 @@ Check for reparent.
Only add window to list if its the window is a topmost window. 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. 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. 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. Load cuda at runtime with dlopen.
Track window damages and only update then. That is better for output file size. 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. Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way.

View File

@ -6,7 +6,7 @@ platforms = ["posix"]
[config] [config]
include_dirs = ["/opt/cuda/targets/x86_64-linux/include"] include_dirs = ["/opt/cuda/targets/x86_64-linux/include"]
libs = ["/usr/lib/libcuda.so"] libs = ["/usr/lib64/libcuda.so"]
[define] [define]
PULSEAUDIO = "1" PULSEAUDIO = "1"

8
record-selected.sh Executable file
View File

@ -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"