From 4162e9b2720d58df5d19a29f91d5c26034fa7aa0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 30 Jan 2022 23:24:20 +0100 Subject: [PATCH] Remove dependency on sibs for building --- .gitignore | 5 +++++ README.md | 2 +- build.sh | 8 ++++++++ interactive.sh | 2 +- replay.sh | 2 +- twitch-stream-local-copy.sh | 2 +- twitch-stream.sh | 2 +- 7 files changed, 18 insertions(+), 5 deletions(-) create mode 100755 build.sh diff --git a/.gitignore b/.gitignore index 47f12d9..2171b80 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,9 @@ sibs-build/ compile_commands.json tests/sibs-build/ tests/compile_commands.json + .clangd/ + +main.o +sound.o +gpu-screen-recorder diff --git a/README.md b/README.md index 5511c06..59583b0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ When recording a 4k game, fps drops from 30 to 7 when using OBS Studio, however the fps remains at 30. # Installation -gpu screen recorder can be built using [sibs](https://git.dec05eba.com/sibs) or if you are running Arch Linux, then you can find it on aur under the name gpu-screen-recorder-git (`yay -S gpu-screen-recorder-git`).\ +Run `./build.sh` or if you are running Arch Linux, then you can find gpu screen recorder on aur under the name gpu-screen-recorder-git (`yay -S gpu-screen-recorder-git`).\ Recording monitors requires a gpu with NvFBC support (note: this is not required when recording a single window!). Normally only tesla and quadro gpus support this, but by using [nvidia-patch](https://github.com/keylase/nvidia-patch) or [nvlax](https://github.com/illnyang/nvlax) you can do this on all gpus that support nvenc as well (gpus as old as the nvidia 600 series), provided you are not using outdated gpu drivers. # How to use diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ee1e9b3 --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/sh -e + +dependencies="glew libavcodec libavformat libavutil x11 xcomposite glfw3 libpulse-simple libswresample" +includes="$(pkg-config --cflags $dependencies) -I/opt/cuda/targets/x86_64-linux/include" +libs="$(pkg-config --libs $dependencies) /usr/lib/libcuda.so -ldl -pthread -lm" +g++ -c src/sound.cpp -O2 $includes -DPULSEAUDIO=1 +g++ -c src/main.cpp -O2 $includes -DPULSEAUDIO=1 +g++ -o gpu-screen-recorder -O2 sound.o main.o -s $libs diff --git a/interactive.sh b/interactive.sh index 425cd25..91ae9f7 100755 --- a/interactive.sh +++ b/interactive.sh @@ -29,4 +29,4 @@ read output_file_name output_dir=$(dirname "$output_file_name") mkdir -p "$output_dir" -./sibs-build/linux_x86_64/release/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 "$selected_audio_input" -o "$output_file_name" diff --git a/replay.sh b/replay.sh index 8842f5c..1e5eb56 100755 --- a/replay.sh +++ b/replay.sh @@ -1,4 +1,4 @@ #!/bin/sh [ "$#" -ne 5 ] && echo "usage: replay.sh " && exit 1 -./sibs-build/linux_x86_64/release/gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$3" -r "$4" -o "$5" +./gpu-screen-recorder -w "$1" -c mp4 -f "$2" -a "$3" -r "$4" -o "$5" diff --git a/twitch-stream-local-copy.sh b/twitch-stream-local-copy.sh index 8101bbc..fb7dfbb 100755 --- a/twitch-stream-local-copy.sh +++ b/twitch-stream-local-copy.sh @@ -3,4 +3,4 @@ # Stream on twitch while also saving the video to disk locally [ "$#" -ne 5 ] && echo "usage: twitch-stream-local-copy.sh " && exit 1 -./sibs-build/linux_x86_64/release/gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$3" | tee -- "$5" | ffmpeg -i pipe:0 -c:v copy -f flv -- "rtmp://live.twitch.tv/app/$4" +./gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$3" | tee -- "$5" | ffmpeg -i pipe:0 -c:v copy -f flv -- "rtmp://live.twitch.tv/app/$4" diff --git a/twitch-stream.sh b/twitch-stream.sh index 325fd23..fac052b 100755 --- a/twitch-stream.sh +++ b/twitch-stream.sh @@ -1,4 +1,4 @@ #!/bin/sh [ "$#" -ne 4 ] && echo "usage: twitch-stream.sh " && exit 1 -./sibs-build/linux_x86_64/release/gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$3" | ffmpeg -i pipe:0 -c:v copy -f flv -- "rtmp://live.twitch.tv/app/$4" +./gpu-screen-recorder -w "$1" -c flv -f "$2" -a "$3" | ffmpeg -i pipe:0 -c:v copy -f flv -- "rtmp://live.twitch.tv/app/$4"