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.
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.
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..
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.
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.
> 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](https://github.com/fangfufu/Linux-Fake-Background-Webcam), 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.
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.
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?
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](https://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.
>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)
I want to thank you both for this discussion thread. I appreciate learning in the comments section and although not everyone can agree at times, it's nice to see the informative discourse of opinions while keeping things civil.
And again, they are just websites and work just fine in the browser. Just use the "install as an app" option and it's indistinguishable from the standalone Electron app.
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.
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.
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 ?
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).
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.
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.
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.
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.
It seems pretty cool, but why does it need to be run as root? I can run [Linux-Fake-Background-Webcam](https://github.com/fangfufu/Linux-Fake-Background-Webcam) just fine without root!
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
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?
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.
> 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.
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).
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.
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.
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.
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?
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.
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!*
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 :)
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)
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.
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?)
Your [submission](https://www.reddit.com/r/linux/comments/qdauwm/python_script_workaround_to_be_able_to_use/) 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](/message/compose/?to=/r/linux) if you have any questions or concerns.*
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.
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.
What's the setup with that for virtual backgrounds? It's it a Droidcam feature?
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.
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.
Title undersells it! I use Bluejeans at work, which doesn't support virtual backgrounds either. Title makes it sound like this is Teams-only.
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).
Need Edge for it to work good. Firefox is a little buggy.
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?
Nope. Had to join a Teams call yesterday and Firefox didn't work.
You could try spoofing an MS Edge browser on Firefox by changing the user agent. I heard that helps.
They depend on chromium specific APIs. I tried
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..
Apparently Teams depends on Chromium specific APIs.
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.
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.
> 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](https://github.com/fangfufu/Linux-Fake-Background-Webcam), 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.
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.
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?
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](https://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.
Oh yeah your right, didn't realize we were talking about the same thing. š
>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)
[ŃŠ“алено]
I want to thank you both for this discussion thread. I appreciate learning in the comments section and although not everyone can agree at times, it's nice to see the informative discourse of opinions while keeping things civil.
Electron is clunky but Iād venture to guess itās the only reason a lot of these apps like Slack and Discord even support Linux to begin with.
And again, they are just websites and work just fine in the browser. Just use the "install as an app" option and it's indistinguishable from the standalone Electron app.
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.
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.
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 ?
I've never tried, but my gut says that, no. You *can* login via separate browsers, or open the others in private browsing / incognito.
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).
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.
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.
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.
I used the site as is. This will explain the difference between our observations
[ŃŠ“алено]
Yep, works great with Edge.
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.
It doesn't work well in firefox.
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.
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.
Have you tries setting the output resolution to 1280x720 in OBS? This fixed the black screen issue for me
This is exactly what I need ā¤ļø my room is small and always messy. Was looking for the feature on teams with no avail
It seems pretty cool, but why does it need to be run as root? I can run [Linux-Fake-Background-Webcam](https://github.com/fangfufu/Linux-Fake-Background-Webcam) just fine without root!
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
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?
It's not my module, and I don't want to force people to install some random kernel module they know nothing about.
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.
> 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.
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).
Amazing
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.
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.
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.
Nono! You're the dev for this project :) I eventually will be able to use this. Just not now :/
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?
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.
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!*
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 :)
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)
How do you do modprobe in user space?
sudo
Then that's not userspace lol
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.
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?)
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
>Well, I'm an engineer, so of course, I found a solution. TF2 reference?
Your [submission](https://www.reddit.com/r/linux/comments/qdauwm/python_script_workaround_to_be_able_to_use/) 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](/message/compose/?to=/r/linux) if you have any questions or concerns.*
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.