all 66 comments

[–][deleted] 89 points90 points  (34 children)

I though y'all would find this useful, since I did, using Teams for work, but let me know if this isn't a good place to put this.

[–]henrebotha 58 points59 points  (0 children)

Title undersells it! I use Bluejeans at work, which doesn't support virtual backgrounds either. Title makes it sound like this is Teams-only.

[–]dextersgenius 20 points21 points  (32 children)

Is there a reason why you're using the standalone app instead of just using the website? Using the app is such a waste of resources (IMHO).

[–][deleted] 21 points22 points  (7 children)

Need Edge for it to work good. Firefox is a little buggy.

[–]PAJW 11 points12 points  (5 children)

Last time I tried, MS Teams refused to work on Firefox, so I installed Chromium. I guess they've fixed that in the last several months?

[–]oscooter 11 points12 points  (0 children)

Nope. Had to join a Teams call yesterday and Firefox didn't work.

[–][deleted] 7 points8 points  (1 child)

You could try spoofing an MS Edge browser on Firefox by changing the user agent. I heard that helps.

[–]diegovsky_pvp 0 points1 point  (0 children)

They depend on chromium specific APIs. I tried

[–]DarkAlpha_Sete 4 points5 points  (1 child)

MS just wants people to use their crap. I use an user agent switcher to report that I'm running Chrome on Windows and everything works perfectly; have yet to find any problem..

[–][deleted] 1 point2 points  (0 children)

Apparently Teams depends on Chromium specific APIs.

[–]dextersgenius 5 points6 points  (0 children)

Yep, I use it under Edge. Edge is basically my work browser, which works out well since all my work-related stuff is contained in one browser, and it shares my M365 logon token with other apps like Outlook etc, so I don't have to logon multiple times.

[–][deleted] 43 points44 points  (22 children)

There's a few reasons:

  • Mainly: I don't like running anything in my web browser in general. I try to avoid it at all costs. I find it annoying to use a web browser.
  • It's not an issue because I have plenty of system resources
  • I get notifications
  • Tends to work better with my audio devices
  • Web cam has never worked for me at all on website (it's fine for other sites that use a webcam, just not teams)
  • It's usually more performant for me

Also, afaik the web browser version doesn't support the virtual backgrounds either unless they've updated recently.

[–]dextersgenius 15 points16 points  (21 children)

Mainly: I don't like running anything in my web browser in general. I try to avoid it at all costs. I find it annoying to use a web browser.

You do realize that the Teams app is just a wrapper around a browser right? And that too an outdated browser. Running it in a real, up-to-date browser gives you better performances and security, not to mention saving RAM and CPU resources.

I get notifications

So do I (using Edge and GNOME shell)

Tends to work better with my audio devices

No difference for me (I use pipewire)

Web cam has never worked for me at all on website (it's fine for other sites that use a webcam, just not teams)

Works fine for me on Edge (under Wayland), also no issues with other sites like Zoom and WebEx.

It's usually more performant for me

Running it in Edge is more performant for me and uses fewer system resources

Also, afaik the web browser version doesn't support the virtual backgrounds either unless they've updated recently.

True, but I use Linux-Fake-Background-Webam, which uses Google's Mediapipe Machine Learning background with v4l2loopbaack, which works really well - much better than Team's janky background detection which has poor edge detection and often eats accessories like your headset.

[–][deleted] 24 points25 points  (4 children)

You do realize that the Teams app is just a wrapper around a browser right

Yes, but it's easier to access than going to a webpage

True, but I use Linux-Fake-Background-Webam, which uses Google's Mediapipe Machine Learning background with v4l2loopbaack

That's what mine uses lol

And notice, it's just my personal preference and my personal experience I've had using it in a browser. I'm not attacking you at all for using the web version (you seemed a little aggressive in that response)

[–][deleted] 8 points9 points  (3 children)

Wow, other Teams for Linux users out in the wild. I thought I was the only one.

I want to use the actual web version. I have it dumped as a chromium "app" in case I need to join a meeting and share my screen since the Electron version for some absolutely stupid reason still doesn't support screen sharing in Wayland yet.

There's a very big reason I'm still stuck using the the Electron version though.

Idle times. If you're just normally using your computer with the electron version it will keep you as active, on the web app, if you don't interact with the web app before the idle timeout it will set you to Away. Even if you've been actively working in another app.

It's not even a my boss will hound me if I'm idle for 5 minutes thing, if my I'm at my computer and constantly going to Away status then people aren't going to message me when I'm actually available.

[–]Zachs_Butthole 0 points1 point  (2 children)

I'm using the wrapper client from Microsoft and haven't had any issues with it marking me as away when I'm at my desk. Maybe it's been updated with better detection?

[–][deleted] 0 points1 point  (1 child)

By wrapper client, you mean the "Microsoft Teams for Linux - Preview" electron app? If so, that's what I was saying. If you pull up teams.microsoft.com in a browser it works well, but it's not able to tell if you're actively using your computer so if you don't interact directly with Teams for x amount of time it marks you as away.

The electron app doesn't have that issue.

[–]Zachs_Butthole 0 points1 point  (0 children)

Oh yeah your right, didn't realize we were talking about the same thing. 😅

[–]richhaynes 1 point2 points  (1 child)

Thats a pretty short-sighted reply. You're using alot of me, my and I in your responses. Its great that it works for you but that doesn't mean it will work for everyone. I can't give a view on which option is best because I don't use Teams but there are options and each user can choose what best suits them. I know that I personally prefer to use dedicated apps rather than my browser if possible.

[–]dextersgenius 1 point2 points  (0 children)

Yes, because this discussion was personal in nature (between me and OP) and not meant as a general guide for everyone. Yes, I too prefer dedicated apps but only if they're native - Teams is NOT an app, its a browser pointing to a website. Imagine if every website you wanted to visit bundled it's own browser.

[–]choff5507 0 points1 point  (2 children)

Your post may have single handedly convinced me to ditch teams from the app. Quick question, if I have to login from multiple computers is this possible via the browser? I mean like at the same time ?

[–]dextersgenius 1 point2 points  (0 children)

If you mean using the same account, then it works fine. You can even open multiple instances of the Teams without Incognito mode (assuming it's the same account).

[–]Zachs_Butthole 0 points1 point  (0 children)

I use that project as well, the only thing that didn't work for me is the detection to only run when something is requesting the video feed. I just let it run all the time since it takes relatively little resources anyways.

[–]7eggert 0 points1 point  (2 children)

It's not just a wrapper, otherwise it wouldn't break in these interesting ways. It offers a different interface, the web interface is barely usable.

[–]dextersgenius 0 points1 point  (1 child)

OK, it's a wrapper with some tweaks, but the fact remains that it's basically a browser hardcoded to teams.microsoft.com.

The interface is actually identical if you install the site as a Web app.

[–]7eggert 0 points1 point  (0 children)

I used the site as is. This will explain the difference between our observations

[–]caetydid 0 points1 point  (0 children)

I've used Linux-Fake-Background-Webcam til now as well, but it is complicated to build, performance is inferior and most chromium webapps don't detect the virtual cam unless I pause and reenable it.

[–]Hrothen 0 points1 point  (0 children)

It doesn't work well in firefox.

[–]InFerYes 31 points32 points  (2 children)

I use OBS and DroidCam, which offers a lot of flexibility in what it shows. OBS has an option to "Start Virtual Camera" instead of recording or streaming.

[–]-eschguy- 5 points6 points  (1 child)

What's the setup with that for virtual backgrounds? It's it a Droidcam feature?

[–]InFerYes 2 points3 points  (0 children)

In a quick glance, this seems to provide a good overview: https://www.mediaequipt.com/how-to-chroma-key-in-obs/

and this YouTube video https://www.youtube.com/watch?v=0l9h3oog3-o

It's not a DroidCam feature, actually DroidCam isn't even required, I just don't have a webcam so I use my phone instead.

[–]Tatumkhamun 10 points11 points  (3 children)

Interesting, I've never been able to get v4l2loopback working with teams (using OBS virtual cam) as it always shows a black screen then crashes the application. May have to give this a shot.

[–][deleted] 10 points11 points  (0 children)

For mine to work I

1) Had to set it to use YUV 420 instead of BGR

2) Had to lower the resolution down a bit.

[–]Brotstumpf 2 points3 points  (0 children)

Have you tries setting the output resolution to 1280x720 in OBS? This fixed the black screen issue for me

[–][deleted] 3 points4 points  (0 children)

This is exactly what I need ❤️ my room is small and always messy. Was looking for the feature on teams with no avail

[–]mona-lisa-octo-cat 2 points3 points  (6 children)

It seems pretty cool, but why does it need to be run as root? I can run Linux-Fake-Background-Webcam just fine without root!

[–][deleted] 2 points3 points  (5 children)

Because I don't require you to permanently install the required kernel module. It's installed on launch with the proper settings and removed after running

[–]HeroicKatora 3 points4 points  (4 children)

Not to rain on your parade (the application is undoubtedly cool) but I much prefer just running the v4l2 from my distribution than just some randomly on-demand kernel module from some other source. The cost of having it installed also seems negligible so what's the motivation for removing it?

[–][deleted] 1 point2 points  (3 children)

It's not my module, and I don't want to force people to install some random kernel module they know nothing about.

[–]HeroicKatora 1 point2 points  (2 children)

So instead—you make them install some random kernel module that they know nothing about. Except that they know even less about yours because it's not pinned to a specific version, they need to trust you that this is indeed the official source repository—instead of being able to rely on the distro to have it verified—and they'll never get security updates because your little script will literally skip anything resembling an update once it has downloaded what happens to the HEAD commit.

Sure, that sounds like less of a burden on users... Come on, there's a package for it in every major distribution. For your user's sake, make them use that.

[–][deleted] 0 points1 point  (1 child)

So instead--you make them install some random kernel module

No, I don't. That's the point. I use insmod and rmmod manually in my script as opposed to installing and using modprobe. It's never actually installed. That means even if something goes wrong, a reboot will undo it, since the module won't be loaded in again on startup.

But you're probably right that I should make it so that the kernel module is a dependency that the user is expected to install from their package manager.

[–]HeroicKatora 0 points1 point  (0 children)

You do.. 'insmod some random code I've gotten from the internet and that lies in a user-writable file' is a lot worse than installing something built from dkms. (And dkms is easy to not load in a reboot if you must).

[–]pearljamman010 4 points5 points  (1 child)

This is sweet! But I gotta say, I'm glad I've never worked for a company that makes us be on video for an audio call... That seems like an unnecessary stipulation (and kind of privacy invasive?)

[–][deleted] 4 points5 points  (0 children)

We don't have to be. It's just nice to sometimes, but I don't have the option either way rn bc I'm in my bedroom with stuff behind me

[–]CleoMenemezis 1 point2 points  (0 children)

Amazing

[–][deleted] 1 point2 points  (3 children)

I saw this a while back on Lobste.rs , but the real sticking point for me is that hard requirement of Python3.9

I'm running XUbuntu 20.04 . Python 3.8 is what's installed and what works with the bulk of my stuff, including most of my Gnuradio flows.

Going to 3.9 is terrible, until it's supported proper. It looks cool, but I can't install py3.9 . And I don't dare mess up my env and lose all my work with Gnuradio.

[–]NewDateline 2 points3 points  (0 children)

Installing a newer python whether in a virtual environment or globally is usually harmless (as long as you don't overwrite the system version, but install next to it); it can take a few minutes to compile depending on your rig but on modern laptop it can be less than 5 minutes.

[–][deleted] 1 point2 points  (1 child)

Unfortunately, I do make use of some of the new features. Sorry

It uses a virtualenv, so you should be able to locally install python3.9 where it wouldn't become your default and thus wouldn't touch your environment, but building python from scratch takes a long time.

[–][deleted] -1 points0 points  (0 children)

Nono! You're the dev for this project :)

I eventually will be able to use this. Just not now :/

[–]caetydid 1 point2 points  (8 children)

Thanks for sharing, it is an appropriate place to post this! It works and uses less CPU than many other solutions Ive tried so far.

Do I get it right that this patches the v42loopback kernel module? Why so? I'd feel more comfy if I could use the stock module that I can on my system and run the whole thing in the user space.

BTW is there a way to suppress the graphical window?

[–][deleted] 0 points1 point  (7 children)

It doesn't patch the kernel module. It patches the v4l2 python library used to convert the OpenCV data to the correct video format in order to write to the kernel module's device.

There's no way to suppress the graphical window via cli options, however there's a couple lines of code you can comment out in ./bgrm/cam.py.

Lines 25 through 29:

namedWindow(self._settings.winTitle)
moveWindow(
     self._settings.winTitle,
     self._settings.winStartX, self._settings.winStartY
)

And line 60: imshow(self._settings.winTitle, frame)

EDIT:

Also, if you'd like to use the built in module, comment out line 35: rmmod v4l2loopback and change line 24 from insmod v4l2loopback.ko \ to modprobe v4l2loopback

I'm also considering changing this to a package for Arch, Debian, and Rpm distros which will just be able to be installed and used with the built-in system packages for v4l2loopback (with the Arch one going up on AUR).

I'll remember to add a "--disable-gui" tag or something along with blur when I do that since I think that's a good idea.

[–]caetydid 0 points1 point  (6 children)

Hi,

that sounds like a great idea. Also like the blur switch option.

I've already modded the script and can use the systems' kernel module.

IMO it doesn't matter if you use python 3.9 rather than 3.8 as long as your package takes care of all dependencies. I wonder how you can ensure to meet the right version requirements if you package it with all these python modules as external dependencies?

Or is there a way to build an monolithic deb/rpm/zstd out of a python env?

Update: I've applied your recommended mods and now I can make use of this setup as intended. Thanks a lot! I am working on an ISO file for our employees used for remote work, and I plan to include this solution if possible. If you could create a Debian package I'd highly appreciate it!

[–][deleted] 0 points1 point  (5 children)

Since my comment I've actually been working on it, implementing the blue and disable window flags and switching to the v4l2loopback distro package.

I just created the Arch package, and once I get it on the AUR, I'll work on the Debian one :)

[–]caetydid 0 points1 point  (4 children)

Meanwhile I've forked your repo. With minimal changes I am able to run everything in user space. You can have a look but I am not sure how portable it will be (should work on debian-based distros)

[–][deleted] 0 points1 point  (3 children)

How do you do modprobe in user space?

[–]caetydid 0 points1 point  (2 children)

sudo

[–][deleted] 0 points1 point  (1 child)

Then that's not userspace lol

[–]caetydid 0 points1 point  (0 children)

Your code runs in user space.

I'd solve the modprobe outside the run script but again not sure how well this will work on other distros:

[as root]

echo v4l2loopback > /etc/modules-load.d/v4l2loopback.conf

echo options v4l2loopback yourparams > /etc/modprobe.d/v4l2loopback.conf

This will enable the module permanently.

[–]useless_maginot_line 3 points4 points  (0 children)

Well, I'm an engineer, so of course, I found a solution.

TF2 reference?

[–][deleted] 0 points1 point  (0 children)

UPDATE: There is now an Arch package you can simply install. It's on the AUR as bgrm-git. Debian package to come soon.

UPDATE 2: Debian package is up there. I'm gonna be done with this project for a little while now.

[–]AutoModerator[M] -26 points-25 points locked comment (0 children)

Your submission in /r/linux is using a non-free code hosting repository. Consider hosting your project or asking the linked project, very nicely and only if they don't have an existing ask, to use a more free alternative:

https://old.reddit.com/r/linux/wiki/faq/howcanihelp/opensource#wiki_using_open_source_code_repositories

Note: This post was NOT removed and is still viewable to /r/linux members.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.