-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Sound in screen share on Linux #154
Comments
I'll probably won't intergrate this project with mine, I think it's a bad practise to depend on third-party binaries. However, I might make a use of NPM and find a module (probably native ones) to directly manage the PulseAudio server. But since it would take me some time to work on that, don't expect it'll be available soon. |
Yeah, that would also work. But it is also going to be compatible with pipewire? (Because you only mentioned PulseAudio) |
If PipeWire replaces it, then yes. |
Pipewire already is the default for many major distros today, like the newest Ubuntu, Pop-Os, Fedora and so on. So I'd say pulse already got replaced. Anyway, shouldn't it also be fine just to support pulse audio and let pipewire-pulse do the rest? In the end, it's your decision, of course. |
I thought about the PulseAudio server using PipeWire. On many distributions PipeWire can be either installed alongside PulseAudio (and probably used as a separate audio system) or replace PulseAudio when a separate package is installed ( I hope that clears things up. |
Ohh okay, that makes sense, thanks. |
And here's a few more details about the audio issue on Linux:1. Upstream issue: [Linux] System loopback audio capture (#1143761).
2.
@tmigone/pulseaudio . |
Hi, when work on this is started, will there be an extra branch for it, that can be watched to stay up to date? |
Probably not. I doubt I will do any changes without experimenting them first. And I think there's no much work at implementing it (only a lot of testing and understanding the module I will decide to use), so there won't be made a lot of commits. But if I feel unsure about its implementation and have concerns whenever it will work or mess up something within my code, then I'll definitely open a new branch. I'll inform on this issue on any progress done. Right now I give it a lower priority due to its complexity, but it might be worked on once I deal with most bugs I can fix, probably finish a Flatpak maker for Reforged project and have a lot of free time. So please be patient or work on it by yourself – it's a bit shame there was no revolutionary code Pull Request on WebCord 😉. |
I see that as a challange :)
ik some JS and TS and worked a little bit with electron before, maybe I can get something working, but I don't know, I will see :) |
I've got a question: |
Wait, I've understand that my Question doesn't make sense, In my Question I was thinking that audio and video have seperate endpoints, but thats prolly not the case, they are probably connected, so its just a matter of injecting the audio into the video stream |
Not quite sure, maybe take a look in the other project and see how they did it. I mean that project: https://github.com/edisionnano/Screenshare-with-audio-on-Discord-with-Linux |
Okay, thx for the info 👍 |
I will also ask the creator of that if he maybe wants to help,m i kinda understnad how it works, but as someone who has made it himself he prolly will be much better at it |
from understand droping Pulseaudio support will make this so much easier, the creator of that project is also saying the same. How about making it a expermintal pipewire only feature for now that need to be enabled first? |
The easiest way to get this working would be to drop pulseaudio support and make a native node addon with node-addon-api and cmake-js that uses rohrkabel capture audio from apps like my virtmic binary does. To match a pipewire node to an X11 window(s) you can use the PID key pipewire provides |
I think it would be great to preserve PulseAudio and X11 compatibility, since PipeWire is still not or can't be used everywhere. And to not reinvent the wheel, the existing module can be used then. And native module implementation might not be a requirement as long as there's a way to communicate with PipeWire/PulseAudio via UNIX socket. This could mean a reimplementation of protocol / client, but could work across different processes – native modules don't play well with Electron's renderer process from my experience. |
I would be totally fine with only supporting pipewire for now if it makes things easier. Later we could then start working to make it compatible with PulseAudio if this is still needed by then. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
There is a new discord client that already supports audio share. Just wanted to let you guys know because I guess some inspiration would make it easier to implement. Also, there is a mention on Reddit that it should be implemented into webcord with over 90 upvotes, so it is definitely a requested feature. |
@DeeBeeDouble it's not the issue to implement in any way. I want to implement it the proper way, at best to have a node module extension to record audio and transfer that data back to Node and at least implement a code to create a virtual sink for all audio output devices and use that as the stream input device. I may play with Rust to achieve this, I have a very little experience writting native Node modules and manipulating the Buffer data. I may also try to develop a code with TypeScript by trying to connect to PulseAudio Unix socket and try manage it using it. The better might be a fully TypeScript-made solution for faster compilation and cross-platform support, yet slower runtime execution (that might not be that slow to affect the overall app's performance). |
Alright, even better |
I've realised that actually it might not be the best idea to use any stream for the screen recording. You see, any modification is likely to be found by Discord if they want to. Using a I may add a flag to forcefully enable audio in screen recording to mitigate this issue, so with the right configuration (monitor as default, microphone as selected input device) you should have both working microphone and system audio. |
Also link to (much prettier) commit info on Github mirror: chromium/chromium@9a3d5ea. You might also find there a tag list which contains versions of Chromium that contains this change, so I guess you might as well use that to estimate whenever this reaches stable Chromium/Electron. |
Looks like Electron It's currently in beta, but testing this with WebCord (with But again if that's the case, with Linux the one could still make a sink in order to precisely select which streams to use for the recording and workaround this issue on their own. I don't think something like this can be made on Windows. |
Awesome, can't wait to test this! Is installing from git good or should I switch to a different branch? |
|
how would one capture via devtools, for the sake of testing? |
I mean, I just use |
I havn't used Windows in years. You are right. That's one way we can capture the output of Have you explored all options on Windows? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I tested Chromium's implementation on Version 123.0.6284.0 (Developer Build) (64-bit), Linux. Capturing system audio on the Tab with For Screen share the The monitor device volume decreases from 100% to ~8% for an unknown reason. |
Looks like we have to disable enable-webrtc-allow-input-volume-adjustment flag for the volume of the captured system audio to not decrease from 100% to 8%. |
I think this did not occur for me when screen sharing on Discord via the Electron, at least both by looking at the |
@SpacingBat3 Here's the code I ran to test
Here's the video demonstrating the volume decrease from 100% to 8% in PAVU as soon as the capture begins https://issues.chromium.org/action/issues/40155218/attachments/53517043?download=true. See https://issues.chromium.org/issues/40155218#comment27. |
@SpacingBat3 Pardon, capture system audio doesn't work at all for Tab capture. Comment out the |
This comment was marked as resolved.
This comment was marked as resolved.
Given And I've tested this right now, I see the volume of monitor device actually decreases by the default, I guess it might be worth to add a workaround for it before I switch to Electron 29. Unless this will be fixed at the upstream before Electron 29.0.0 will be released, of course. |
I'm on Chromium Version 123.0.6284.0 (Developer Build) (64-bit). The workaround I am using is in the linked gist; I launch with these switches set |
Of course you could skip all of that and just set the default input to the monitor device and use
|
As a side note, switch |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I just commented here because I actually tested what you are talking about re a commit landing in Chromium. Electron uses Chromium source code. On Linux on Chromium capture of monitor devices has not been possible without workaround for around 5 years https://chromium.googlesource.com/chromium/src/+/4519c32f528e079f25cb2afc594ecf625f943782. So I don't think my comments are off-topic. |
Given WebCord has received an update to Electron 29 that should support screen share on Linux, I suppose I can just finally close this issue. |
MOD edit / notes
This issue ticket was previously a request to integrate with the existing solution, which I didn't want to work on – mostly as both JavaScript / TypeScript based client and native Node modules would better integrate with the code and build system (i.e. a such binary I would have to provide would likely has to be somehow rebuilt outside of Electron Forge and probably depend on more libraries / binaries which normally would not be needed for packaging of my application). However it quickly became one of the most popular topics in WebCord and became a bit more generic about sound screen sharing on Linux. It is also very special for me because of the large community interest about resolving it, making it much closer to be finally resolved once and for good. So thank you all for participating in it!
MOD EDIT2: This is now resolved in Chromium, awaiting to be merged to Chromium stable and/or Electron. Right now this is a feature behind the flags, hopefully it will be enabled by the default and will work just fine. See bugs.chromium.org#1143761 and Chromium commit
9a3d5ea
for more details on it.@SpacingBat3
Original message by @DeeBeeDouble:
The text was updated successfully, but these errors were encountered: