obs-backgroundremoval icon indicating copy to clipboard operation
obs-backgroundremoval copied to clipboard

Obs Background Removal for Ubuntu

Open ghost opened this issue 3 years ago • 46 comments

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

ghost avatar Sep 11 '21 04:09 ghost

would like this as well

unk1nd avatar Sep 12 '21 13:09 unk1nd

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)

Zahrun avatar Oct 09 '21 22:10 Zahrun

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

mperezy avatar Oct 13 '21 18:10 mperezy

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 ?

Zahrun avatar Oct 13 '21 19:10 Zahrun

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

mperezy avatar Oct 13 '21 20:10 mperezy

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

Zahrun avatar Oct 13 '21 20:10 Zahrun

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 avatar Oct 13 '21 20:10 mperezy

@Zahrun

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

image

mperezy avatar Oct 13 '21 20:10 mperezy

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 !!

mperezy avatar Oct 13 '21 21:10 mperezy

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 :)

Zahrun avatar Oct 13 '21 21:10 Zahrun

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 :/

mperezy avatar Oct 13 '21 21:10 mperezy

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 ^^

Zahrun avatar Oct 13 '21 21:10 Zahrun

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 !

mperezy avatar Oct 13 '21 22:10 mperezy

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!

Zahrun avatar Oct 13 '21 22:10 Zahrun

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.

mperezy avatar Oct 13 '21 22:10 mperezy

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 ?

Zahrun avatar Oct 13 '21 22:10 Zahrun

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 avatar Oct 13 '21 22:10 mperezy

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 🤣

mperezy avatar Oct 13 '21 22:10 mperezy

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 https://github.com/royshil/obs-backgroundremoval/issues/26 I’ll see if that can be fixed somehow.

Zahrun avatar Oct 13 '21 22:10 Zahrun

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 🤔

mperezy avatar Oct 13 '21 23:10 mperezy

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 ^^

Zahrun avatar Oct 14 '21 00:10 Zahrun

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

mperezy avatar Oct 14 '21 00:10 mperezy

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.

Zahrun avatar Oct 15 '21 16:10 Zahrun

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 ! 🎉

mperezy avatar Oct 18 '21 20:10 mperezy

@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 avatar Oct 22 '21 12:10 mhcerri

@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 ;)

Zahrun avatar Oct 22 '21 23:10 Zahrun

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

image

celorodovalho avatar Dec 23 '21 09:12 celorodovalho

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

Zahrun avatar Dec 23 '21 14:12 Zahrun

@Zahrun image

celorodovalho avatar Dec 30 '21 11:12 celorodovalho

What linux distribution and version of it are you using?

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

Zahrun avatar Dec 30 '21 14:12 Zahrun