From b8f643a7e196962bf3f76b431ff2cfe4a683a55b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 22 Mar 2022 13:08:02 +0100 Subject: [PATCH] Add install script for ubuntu based distros --- README.md | 6 ++++-- install_ubuntu.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 install_ubuntu.sh diff --git a/README.md b/README.md index 5700257..8acc157 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,10 @@ When recording a 4k game, fps drops from 30 to 7 when using OBS Studio, however the fps remains at 30. # Installation -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`).\ -Dependencies needed when building using `build.sh`: `glew glfw3 cuda ffmpeg libx11 libxcomposite libpulse-simple`.\ +If you are running an Arch Linux based distro, then you can find gpu screen recorder on aur under the name gpu-screen-recorder-git (`yay -S gpu-screen-recorder-git`).\ +If you are running an Ubuntu based distro then run `install_ubuntu.sh` as root: `sudo ./install_ubuntu.sh`.\ + +On other distros you need to install dependencies manually and run `build.sh`. Dependencies: `glew glfw3 cuda ffmpeg libx11 libxcomposite libpulse-simple`.\ 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/install_ubuntu.sh b/install_ubuntu.sh new file mode 100755 index 0000000..e443c4c --- /dev/null +++ b/install_ubuntu.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +script_dir=$(dirname "$0") +cd "$script_dir" + +[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1 + +dpkg -l nvidia-cuda-dev > /dev/null 2>&1 +cuda_missing="$?" + +set -e +apt-get -y install build-essential nvidia-cuda-dev\ + libswresample-dev libavformat-dev libavcodec-dev libavutil-dev\ + libx11-dev libxcomposite-dev\ + libglew-dev libglfw3-dev\ + libpulse-dev + +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/x86_64-linux-gnu/stubs/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 +install -Dm755 "gpu-screen-recorder" "/usr/local/bin/gpu-screen-recorder" + +echo "Successfully installed gpu-screen-recorder" +[ "$cuda_missing" -eq 1 ] && echo "You need to reboot your computer before using gpu-screen-recorder because cuda was installed"