obs with background removal

This commit is contained in:
Ryan Bakkes 2023-02-17 08:36:25 +01:00
parent c5fc379d0f
commit db18e41874

42
src/applications/obs.sh Normal file → Executable file
View File

@ -1,2 +1,42 @@
sudo apt update #!/usr/bin/env bash
# Plugin for enabling virtual camera
sudo apt-get install v4l2loopback-dkms
sudo apt install obs-studio -y sudo apt install obs-studio -y
sudo apt install -y libobs-dev libopencv-dev language-pack-en wget git build-essential cmake libsimde-dev
sudo -u $SUDO_USER wget https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz
sudo tar xzvf onnxruntime-linux-x64-1.7.0.tgz --strip-components=1 -C /usr/local/ --wildcards "*/include/*" "*/lib*/"
# Clone and donwload plugin
sudo -u $SUDO_USER mkdir -p Applications
cd Applications
sudo -u $SUDO_USER git clone https://github.com/royshil/obs-backgroundremoval.git
cd obs-backgroundremoval
# There is still a build failure in the plugin for Ubuntu
# Edit cmake and filter files to fix the problem
sed -i 's/find_package(obs-frontend-api Required)/#find_package(obs-frontend-api Required)/g' CMakeLists.txt
sed -i 's/OBS::libobs OBS::obs-frontend-api/obs obs-frontend-api/g' CMakeLists.txt
# add if statement for a function thats not needed on ubuntu
ex /src/background-filter.cpp <<eof
214 insert
#if _WIN32
.
219 insert
#endif
.
xit
eof
# Build the package
sudo -u $SUDO_USER mkdir build && cd build
cmake .. && cmake --build . && sudo cmake --install .
# add links to plugin / add the plugin to user
sudo -u $SUDO_USER mkdir -p ~/.config/obs-studio/plugins/obs-backgroundremoval/bin/64bit
ln -s /usr/local/lib/obs-plugins/obs-backgroundremoval.so ~/.config/obs-studio/plugins/obs-backgroundremoval/bin/64bit/
ln -s /usr/local/share/obs/obs-plugins/obs-backgroundremoval ~/.config/obs-studio/plugins/obs-backgroundremoval/data