Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obs Background Removal for Ubuntu #34

Closed
ghost opened this issue Sep 11, 2021 · 51 comments · Fixed by #266
Closed

Obs Background Removal for Ubuntu #34

ghost opened this issue Sep 11, 2021 · 51 comments · Fixed by #266
Labels
help wanted Extra attention is needed

Comments

@ghost
Copy link

ghost commented Sep 11, 2021

i like they added background removal for linux (FOR ARCHLINUX)!
i am using ubuntu plz add support for ubuntu
make it .deb file
plz
Thanks

@unk1nd
Copy link

unk1nd commented Sep 12, 2021

would like this as well

@Zahrun
Copy link

Zahrun commented Oct 9, 2021

I added the package to pacstall https://github.com/pacstall/pacstall
It will work only with the obs-studio version from Ubuntu repos (no ppa, no flatpak, no snap)

@mperezy
Copy link

mperezy commented Oct 13, 2021

I added the package to pacstall https://github.com/pacstall/pacstall It will work only with the obs-studio version from Ubuntu repos (no ppa, no flatpak, no snap)

Hi @Zahrun , I tried to use the pacstall and I got this next:
image

And it's caused by libobs0 package is missing, which is needed by libobs-dev so I installed separately but for some reason it removes the obs-studio package so OBS itself is removed, but it's not a big deal because I could installed again without problems:
image

But, the big concern that I have is on the version's SHA number which pacstall says that doesn't match:
image

Do you have any idea how to solve that ?

Thanks in advance

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

Hi @mperezy ,
In the first screenshot I think the issue was that you already had onnxruntime installed on your system so the re-installation failed.
Installing libobs0 should not remove obs-studio. Are you sure you don’t have the obs ppa on your system ?
Hashes don’t match because the v0.3.0-beta file was not found

Can you please tell me which distribution and version of it you are running and what version of obs you have ?

@mperezy
Copy link

mperezy commented Oct 13, 2021

Hi @Zahrun.

Yes, you're right. I pasted the wrong screenshot lol. I tried the first time to build the background plugin with the steps described in the readme, that's why the onnxruntime was already exists, I delete it and then I tried with pacstall I got this next:

image

Then I had to install libobs0 manually but as I mentioned it removes obs-studio so I wasn't able to open OBS. And I installed OBS many months ago using the steps from the wepage:

image

The distribution that I'm using:

image

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

My pacscript does not work with the ppa version of OBS.
Run this:
sudo apt remove obs-studio --auto-remove to remove the ppa version
Then remove the ppa:
sudo add-apt-repository ppa:obsproject/obs-studio -r
Then install the obs-studio from Ubuntu repo:
sudo apt update && sudo apt install obs-studio

That is one step. Now the file not found issue is weird, it’s like the file download failed. Try again after the steps I mentionned?
Also I would advise to actually install the -git version: pacstall -I obs-backgroundremoval-git because it is more up to date and has more features. That might also actually not have the hash issue

@mperezy
Copy link

mperezy commented Oct 13, 2021

Yes, using obs-backgroundremoval-git on your pacscript seems it worked:
image

But now I'm not able to open OBS following the steps you shared first in your last comment LOL. I'm only see the loading animation in the mouse cursor and nothing happens:

OBS-issue

What a mess hahaha.
What do you recommend to do now ? I think burn my PC could the problem hahahaha :v

@mperezy
Copy link

mperezy commented Oct 13, 2021

@Zahrun

I tired to run obs-studio from terminal and I'm getting this:

image

@mperezy
Copy link

mperezy commented Oct 13, 2021

I could solve the problem LOL :v. Given that I had the previous OBS configuration in ~/.config/obs-studio I had to remove that folder and now it's working like a charm and the obs-backgroundremoval is working very good. Thanks for your assistance on this, @Zahrun !!

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

Ah I was thinking it might be some configuration from the newer obs-studio that had remained, yes.
I earlier didn’t tell you to do the sudo apt purge obs-studio --auto-remove because I didn’t know if you had some configuration you wanted to keep ^^
Glad you could get it to work :)

@mperezy
Copy link

mperezy commented Oct 13, 2021

Yes!, thanks so much for your help !

Now, I'm facing another issue :v. I didn't remove the previous obs-studio configuration folder, I renamed it. So I was able to restore my profiles and scenes, I can see them in OBS as expected, but I can't restore the StreamFX (for blur background) plugin that I had installed, v4l2sink hopefully was restored and worked fine. Have you used it ? (StreamFX) If so, how did you installed it in this OBS version ?
This is the official repo and steps to install it, given that I already had the plugin, I only copied and pasted the entire folder inside the current OBS configuration but I'm getting that error that I posted above :/

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

Yup it seems StreamFX requires obs-studio version 27 as a minimum since version StreamFX 0.10.1
So you can use StreamFX version 0.10.0 with your current setup.
Or actually, Ubuntu 21.10 will be out tomorrow and deliver obs-studio version 27 so upgrading to ubuntu 21.10 might have obs work with StreamFX 0.10.1
Or I could try to make the pacscript work with the ppa version but I think it’s complicated

PS: thanks I didn’t know about that blur effect and I was looking for one ^^

@mperezy
Copy link

mperezy commented Oct 13, 2021

God dammit !! Hahahahaha you're I didn't notice the current OBS version that I'm running hahahaha, yes! Using StreamFX 0.10.0 solved the problem hahahaha, how can I didn't notice that LOL.

Thanks so so much for your help !, now I'm able to use the blur effect with this background removal plugin! I'm gonna document this to not forget what we discussed here.

Again, thanks so much pal ! I'll try Ubuntu 21.10 and see how it works.

Really appreciate your assistance here, nice work with your pacscript, made my life very easy.

Cheers !

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

I’m glad it could help someone. Actually I am on Kubuntu 21.04 (obs 26) and will upgrade to 21.10 (obs 27) whenever it’s out, so I can also post here to tell you if it works.
I love the pacstall project it’s like the archlinux an AUR for Ubuntu!

@mperezy
Copy link

mperezy commented Oct 13, 2021

Yes, I'm starting to love pacstall as well haha
Nice, if you have news using these plugins with the latest versions I would love it to how those run.

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

Did you manage to get the blur effect with this background removal plugin to work to get the image from the camera with only the background from the same camera blurred ?

@mperezy
Copy link

mperezy commented Oct 13, 2021

You mean this, @Zahrun ?

image

LOL !!
As you can see in the sources I had to create two gopro sources (yes I'm using a Gopro LOL) the first one to remove the background, and the second one blurring all the video capture, and it's working like NVIDIA Broadcast from Windows, well, not so good but it's much better than blurred background from Zoom hahaha.

Mission accomplished !! 😎✌🏻

@mperezy
Copy link

mperezy commented Oct 13, 2021

For the blurred black border it's only an image with that black border and applied the blur effect from StreamFX with Dual Filtering type, Area subtype and size 4.

I'm a kinda blurred blacked border lover 🤣

@Zahrun
Copy link

Zahrun commented Oct 13, 2021

Ah you are lucky you can add two sources from the same camera. It does not work with my cheap webcam. I could use a Source Mirror from StreamFX but I can’t apply the background removal on it. Some people had the same issue #26 I’ll see if that can be fixed somehow.

@mperezy
Copy link

mperezy commented Oct 13, 2021

Jeez !. For some reason, the repo that I'm using to be able to stream my Gopro in Ubuntu makes it visible for many programs that use webcams, so I think that's why I can create more than one source of my GoPro in OBS. Maybe you need to use v4l2loopback to stream your webcam, but it is probably you'll get some latency in your webcam source. Maybe if you check that repo can find a possible solution. I don't have a webcam to make some tests, but I think v4l2loopback could solve your problem 🤔

@Zahrun
Copy link

Zahrun commented Oct 14, 2021

Yup that works!
For anyone having the same issue as me, here is how to do:

  1. Start webcamoid
  2. Go to camera source, select source and resolution
  3. Go to preferences and enable virtual camera output
  4. In OBS, add V4L2 selecting the webcamoid virtual output
  5. You can add two: one with obs-backgroundremoval and the other with StreamFX blur

All good

EDIT: If you also want to use the OBS virtual camera output:

  1. Stop obs
  2. Unload v4l2loopback module sudo rmmod v4l2loopback
  3. Load it again with two devices sudo modprobe v4l2loopback devices=2
  4. Start webcamoid
  5. Go to camera source, select source and resolution
  6. Go to preferences and enable virtual camera output
  7. Make sure the device selected is the second one because OBS will use the first one
  8. Uncheck virtual camera box and recheck virtual camera box to apply the change of device
  9. In OBS, add V4L2 selecting the webcamoid virtual output
  10. You can add two: one with obs-backgroundremoval and the other with StreamFX blur
  11. Start Obs virtual camera, it should take the other v4l2loopback device

Good luck ^^

@mperezy
Copy link

mperezy commented Oct 14, 2021

Looks really good !

I'm glad you could solve your webcam issue with v4l2loopback on webcamoid.

Also, as a JIC: Don't forget to add a Chroma Key effect filter to completely remove the background

image

image

@Zahrun
Copy link

Zahrun commented Oct 15, 2021

Hey! Quick post to confirm the upgrade from 21.04 to 21.10 went well. For some reason when I tried obs at first the obs-backgroundremoval seemed super laggy. So reinstalled the background removal with pacsstall and it works well now.
So Ubuntu 21.10 + OBS 27 from repos + obs-backgroundremoval-git + StreamFX 0.10.1 works fine.
If your setup is working fine with StreamFX 0.10.0 you can also choose to keep it as well.

@mperezy
Copy link

mperezy commented Oct 18, 2021

Yes, absolutely right ! I upgraded to Ubuntu 21.10 and now having OBS 27.0.1 it's working very well with obs-backgroundremoval and StreamFX (latest version) plugins.

Nice ! 🎉

@mhcerri
Copy link

mhcerri commented Oct 22, 2021

@Zahrun Another option is the NDI plugin. You can add an NDI output filter to your cam source and create several NDI sources from it that you can use to apply the blur effect and the background removal filters.

@Zahrun
Copy link

Zahrun commented Oct 22, 2021

@mhcerri, thank you for sharing the solution, it works great, and it is simpler to use!
I added obs-ndi-deb as a package in pacstall ;)

@celorodovalho
Copy link

I followed all step, but I have this error when trying to compile:

image

@Zahrun
Copy link

Zahrun commented Dec 23, 2021

In the pacscript, I use the following:

cmake -j$(nproc) -DobsIncludePath=/usr/include/obs .. && cmake --build . -j$(nproc)
sudo cmake --install .

Maybe try this

Otherwise, just use pacstall -I obs-backgroundremoval-git

@celorodovalho
Copy link

@Zahrun
image

@Zahrun
Copy link

Zahrun commented Dec 30, 2021

What linux distribution and version of it are you using?

Can you try the pacstall installation method ? pacstall -I obs-backgroundremoval-git

@ZlowrogiTuru
Copy link

What linux distribution and version of it are you using?

Can you try the pacstall installation method ? pacstall -I obs-backgroundremoval-git

Using pacstall to install obs-backgroundremoval removes obs-studio in a processes. Tried this mutliple times and at the end I can't launch obs anymore.

@Zahrun
Copy link

Zahrun commented Jan 18, 2022

What linux distribution and version of it are you using?
Can you try the pacstall installation method ? pacstall -I obs-backgroundremoval-git

Using pacstall to install obs-backgroundremoval removes obs-studio in a processes. Tried this mutliple times and at the end I can't launch obs anymore.

Please refer to my previous answer #34 (comment)

@MadMartian
Copy link

You could build your own deb, but I found this was easy enough to build from source.
Even the CUDA GPU version was fairly straightforward (had to use ONNX v1.7.0, other than that pretty straightforward)

@frdsofficial
Copy link

frdsofficial commented Jan 29, 2022

My pacscript does not work with the ppa version of OBS. Run this: sudo apt remove obs-studio --auto-remove to remove the ppa version Then remove the ppa: sudo add-apt-repository ppa:obsproject/obs-studio -r Then install the obs-studio from Ubuntu repo: sudo apt update && sudo apt install obs-studio

That is one step. Now the file not found issue is weird, it’s like the file download failed. Try again after the steps I mentionned? Also I would advise to actually install the -git version: pacstall -I obs-backgroundremoval-git because it is more up to date and has more features. That might also actually not have the hash issue

When I try to install pacstall -I obs-backgroundremoval-git I got this message: [!] ERROR: You seem to be offline. What can I do? I'm using Lubuntu 18.04.

@deymisluis
Copy link

deymisluis commented Feb 16, 2022

My pacscript does not work with the ppa version of OBS. Run this: sudo apt remove obs-studio --auto-remove to remove the ppa version Then remove the ppa: sudo add-apt-repository ppa:obsproject/obs-studio -r Then install the obs-studio from Ubuntu repo: sudo apt update && sudo apt install obs-studio
That is one step. Now the file not found issue is weird, it’s like the file download failed. Try again after the steps I mentionned? Also I would advise to actually install the -git version: pacstall -I obs-backgroundremoval-git because it is more up to date and has more features. That might also actually not have the hash issue

When I try to install pacstall -I obs-backgroundremoval-git I got this message: [!] ERROR: You seem to be offline. What can I do? I'm using Lubuntu 18.04.

Same thing happens in Xubuntu 20.04.

@Zahrun
Copy link

Zahrun commented Mar 19, 2022

I installed Xubuntu 20.04 in a VM and installed obs-studio, pacstall, and obs-backgroundremoval-git.
It works fine.
Are you connected to the internet when you install the pacscript?
Try:

pacstall -U
pacstall -I obs-backgroundremoval-git

@Zahrun
Copy link

Zahrun commented Mar 19, 2022

Actually it seems to be a pacstall bug pacstall/pacstall#516 and pacstall/pacstall#502
So first try the above

pacstall -U
pacstall -I obs-backgroundremoval-git

If that does not work you can do this:

pacstall -U pacstall develop
pacstall -I obs-backgroundremoval-git

@Zahrun
Copy link

Zahrun commented Mar 19, 2022

My pacscript does not work with the ppa version of OBS. Run this: sudo apt remove obs-studio --auto-remove to remove the ppa version Then remove the ppa: sudo add-apt-repository ppa:obsproject/obs-studio -r Then install the obs-studio from Ubuntu repo: sudo apt update && sudo apt install obs-studio
That is one step. Now the file not found issue is weird, it’s like the file download failed. Try again after the steps I mentionned? Also I would advise to actually install the -git version: pacstall -I obs-backgroundremoval-git because it is more up to date and has more features. That might also actually not have the hash issue

When I try to install pacstall -I obs-backgroundremoval-git I got this message: [!] ERROR: You seem to be offline. What can I do? I'm using Lubuntu 18.04.

I installed Lubuntu 18.04 in a VM.
For the error you mention, please see my above answer.
But then you will get a OpenCV version compatibility issue (required 4.2, available 3.2.0)

Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "4.2".

  The following configuration files were considered but not accepted:

    /usr/share/OpenCV/OpenCVConfig.cmake, version: 3.2.0

Either move to Lubuntu 20.04 or find an updated version of OpenCV somewhere. There might be other issues after this, but I would recommend update to Lubuntu 20.04 anyway. Or 22.04 soon.

@carlosevi94
Copy link

I everyone, I'm on Ubuntu 20.04, im trying to install using pacstall -I obs-backgroundremoval-git but I get stucked here

Fail on instalation

Maybe is a way to change something in pacstall script and get it run???

@misskecupbung
Copy link

My pacscript does not work with the ppa version of OBS. Run this: sudo apt remove obs-studio --auto-remove to remove the ppa version Then remove the ppa: sudo add-apt-repository ppa:obsproject/obs-studio -r Then install the obs-studio from Ubuntu repo: sudo apt update && sudo apt install obs-studio
That is one step. Now the file not found issue is weird, it’s like the file download failed. Try again after the steps I mentionned? Also I would advise to actually install the -git version: pacstall -I obs-backgroundremoval-git because it is more up to date and has more features. That might also actually not have the hash issue

When I try to install pacstall -I obs-backgroundremoval-git I got this message: [!] ERROR: You seem to be offline. What can I do? I'm using Lubuntu 18.04.

Same with me, I installed it through the deb file and it works.

@misskecupbung
Copy link

I everyone, I'm on Ubuntu 20.04, im trying to install using pacstall -I obs-backgroundremoval-git but I get stucked here

Fail on instalation

Maybe is a way to change something in pacstall script and get it run???

I installed the dependencies first and it works on my Ubuntu 20.04

sudo apt remove obs-studio --auto-remove
sudo add-apt-repository ppa:obsproject/obs-studio -r
sudo apt update && sudo apt install obs-studio
sudo apt install -y libobs-dev libopencv-dev language-pack-en wget git build-essential cmake

@carlosevi94
Copy link

I installed the dependencies first and it works on my Ubuntu 20.04

sudo apt remove obs-studio --auto-remove
sudo add-apt-repository ppa:obsproject/obs-studio -r
sudo apt update && sudo apt install obs-studio
sudo apt install -y libobs-dev libopencv-dev language-pack-en wget git build-essential cmake

Now its works!!! Thanks! :D

@DJYeh
Copy link

DJYeh commented May 30, 2022

I was following the instructions when I got problem with onnxruntime. I'm not familiar with pacstall. Any idea how to fix this?

WARNING! stowing onnxruntime-1-7-0-bin would cause conflicts:

  • existing target is neither a link nor a directory: usr/local/include/cpu_provider_factory.h
  • existing target is neither a link nor a directory: usr/local/include/cuda_provider_factory.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_c_api.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_cxx_api.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_cxx_inline.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_session_options_config_keys.h
  • existing target is neither a link nor a directory: usr/local/lib/libonnxruntime.so.1.7.0
  • existing target is not owned by stow: usr/local/lib/libonnxruntime.so
    All operations aborted.
    [!] ERROR: Package contains links to files that exist on the system
    [+] INFO: Cleaning up
    [!] ERROR: Failed to install onnxruntime-1-7-0-bin

@herteljt
Copy link

herteljt commented Jun 24, 2022

I was following the instructions when I got problem with onnxruntime. I'm not familiar with pacstall. Any idea how to fix this?

WARNING! stowing onnxruntime-1-7-0-bin would cause conflicts:

  • existing target is neither a link nor a directory: usr/local/include/cpu_provider_factory.h
  • existing target is neither a link nor a directory: usr/local/include/cuda_provider_factory.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_c_api.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_cxx_api.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_cxx_inline.h
  • existing target is neither a link nor a directory: usr/local/include/onnxruntime_session_options_config_keys.h
  • existing target is neither a link nor a directory: usr/local/lib/libonnxruntime.so.1.7.0
  • existing target is not owned by stow: usr/local/lib/libonnxruntime.so
    All operations aborted.
    [!] ERROR: Package contains links to files that exist on the system
    [+] INFO: Cleaning up
    [!] ERROR: Failed to install onnxruntime-1-7-0-bin

I followed Zahrun's advice above and did:

pacstall -U pacstall develop
pacstall -I obs-backgroundremoval-git

@billksun
Copy link

@Zahrun Another option is the NDI plugin. You can add an NDI output filter to your cam source and create several NDI sources from it that you can use to apply the blur effect and the background removal filters.

@mhcerri @Zahrun How did you get this working? I am trying to get 2 sources from the same webcam (phone cam via DroidCam OBS) that I can apply different filters to (one obs-backgroundremoval, and the other blur). I didn't get very far:

  1. I added a DroidCam OBS Source, with a Dedicated NDI Output filter.
  2. I then added the NDI Source, but I am unable to see my NDI output created in the previous step in the "Source name" list.

Did something go wrong?

@deymisluis
Copy link

i like they added background removal for linux (FOR ARCHLINUX)! i am using ubuntu plz add support for ubuntu make it .deb file plz Thanks

I tried all the steps here and I was not successful, but I found a snap version with several plugins installed including OBS Background Removal, some may not even like snaps but this one ended up solving my problem and saved me time.

https://github.com/snapcrafters/obs-studio

@MisterDerpie
Copy link

Heya folks,

tried to install the plugin via pacstall but got the error that ../LICENSE isn't found.
There's an easy way around that, simply editing the pacstall script and change the install step

# OLD
install() {
  sudo cmake --install . > /dev/null
  sudo install -Dm644 "../LICENSE" -t "${STOWDIR}/${name}/usr/share/licenses/${name}"
}

to

# NEW
install() {
  cd build/
  sudo cmake --install . > /dev/null
  sudo install -Dm644 "../LICENSE" -t "${STOWDIR}/${name}/usr/share/licenses/${name}"
}

@Zahrun
Copy link

Zahrun commented Jan 4, 2023

Thanks @MisterDerpie , I created a MR to fix the pacscript pacstall/pacstall-programs#2101

@royshil
Copy link
Collaborator

royshil commented Mar 18, 2023

we need to get your help in Archlinux installers again as they are broken

can you please pick up the latest main HEAD and see if you can come up with a fix? 🙏

@royshil royshil added the help wanted Extra attention is needed label Mar 18, 2023
@Zahrun
Copy link

Zahrun commented Mar 21, 2023

we need to get your help in Archlinux installers again as they are broken

can you please pick up the latest main HEAD and see if you can come up with a fix? pray

Ubuntu lunar, the upcoming release, and debian unstable, currently have cmake 3.25.1. I will wait for them to package 3.25.2 and then fix the pacscript.

You wrote archlinux, did you mean to post this in a different thread or did you mean ubuntu?

@Zahrun
Copy link

Zahrun commented May 9, 2023

Quick update for Ubuntu users, the plugin is now available as a flatpak #67 (comment)

I also packaged it in pacstall:

I also wanted to package the support for GPU - TensorRT inference device, but is pending pacstall/pacstall-programs#3309. Also, since 0.5.19, the CPU mode is actually more efficient in my experience #301 (comment). If you want to install GPU - TensorRT support manually, you can execute the following (the download is 1,223 MB and installs 3,104 MB, so it’s pretty big):

sudo apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt update
sudo apt install libnvinfer-bin libcublas11 libcudart11.0 libcurand10 libcufft10 nvidia-driver-530

In Nix, I packaged version 0.5.16. The update to 0.5.19 requires onnxruntime-gpu, which is not currently packaged in Nix NixOS/nixpkgs#228093

EDIT: added libcublas11 libcudart11.0 libcurand10 libcufft10 nvidia-driver-530 to manual GPU - TensorRT install instructions

@umireon umireon pinned this issue May 10, 2023
@royshil royshil unpinned this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.