edisionnano / Screenshare-with-audio-on-Discord-with-Linux

A repo trying to gather all info regarding proper screensharing on Discord with Desktop Audio for linux users
680 stars 11 forks source link

Firefox issue that was mentioned has been fixed #12

Closed StayBlue closed 6 months ago

StayBlue commented 2 years ago

The issue mentioned in README has now been fixed by Mozilla (see here). While the fix isn't yet available in the latest stable release of Firefox (or at least I am fairly sure it isn't), the README should be updated to reflect the issue being fixed.

edisionnano commented 2 years ago

Thanks for letting me know, I'll try firefox 101 when I have time.

Alex-gnzl commented 2 years ago

Script fails due to assuming a 'default' device exists if you don't use the virtmic thing, which it doesn't on Firefox; And if the id is undefined it picks the first available mic, and if it's the same as your mic it leads to Firefox collapsing the captures into one, meaning you can't change what the stream captures.

enumerateDevices's ordering is meaningful, that is the first device is your default mic, which you're the most likely to use in Discord, leading to the scenario above.

I'd make a PR for this, but this repo doesn't contain the actual script, so... Around line 35:

  catch (error) {
    // id = "default";
    await navigator.mediaDevices.enumerateDevices().then(devices => {id = devices[devices.length-1].deviceId});
  }

Be careful with that as it can select your desktop audio, leading to a loopback while you hear your own stream, however it didn't get loud for me, for whatever reason.

By the way, is there source code on the virtmic binary? nvm, i'm blind

edisionnano commented 2 years ago

Script fails due to assuming a 'default' device exists if you don't use the virtmic thing, which it doesn't on Firefox; And if the id is undefined it picks the first available mic, and if it's the same as your mic it leads to Firefox collapsing the captures into one, meaning you can't change what the stream captures.

enumerateDevices's ordering is meaningful, that is the first device is your default mic, which you're the most likely to use in Discord, leading to the scenario above.

I'd make a PR for this, but this repo doesn't contain the actual script, so... Around line 35:

  catch (error) {
    // id = "default";
    await navigator.mediaDevices.enumerateDevices().then(devices => {id = devices[devices.length-1].deviceId});
  }

Be careful with that as it can select your desktop audio, leading to a loopback while you hear your own stream, however it didn't get loud for me, for whatever reason.

~By the way, is there source code on the virtmic binary?~ nvm, i'm blind

default only exists on chromium browsers, the script is going to need few edits to be usable with firefox. We will need to enumeratedevices and pick a monitor probably since we must use a different device then the one discord uses as a mic.

peterfab9845 commented 2 years ago

Firefox 101 has just been released (on the 31st), and I can confirm that the new multiple microphone capture functionality works.

I was successful (with some caveats, see later) on the following setup:

There were a couple of problems, though:

zachmanthethird commented 2 years ago

Okay, I've definitely spent way too long getting this to work for me personally, so I suppose I'll share what I did. I used the Firefox script changing every instance of audio: true to audio: {autoGainControl: false, echoCancellation: false, noiseSuppression: false} and everything appears to be working beautifully. This does fix the previous comment's issue of audio quality, as this properly applies everywhere. However, this solution is not without its own problems:

Sid127 commented 2 years ago

just checking in, has there been any progress on this?

edisionnano commented 2 years ago

just checking in, has there been any progress on this?

I haven't had time to test this yet, however I'm hopeful I'll be able to fix firefox within this month.

edisionnano commented 2 years ago

I checked firefox, the script works out of the box with violentmonkey as long as you have virtmic up and running. There audio issues however, it sounds like playing a vinyl record at inconsistent speed. I will have to check whether firefox has any additional flags that modify audio,

edisionnano commented 2 years ago

One issue I found out is that the first microphone capture is listed as AudioCallbackDriver while the second as input-only stream image

PhantomShift commented 1 year ago

There audio issues however, it sounds like playing a vinyl record at inconsistent speed.

Is there any update on this? Been screen sharing through Chromium with audio with zero issues up until recently but some update seems to have broken video encode on Chromium for me (even with the script off), practically locking the screen share at 1 FPS. Firefox has great performance as usual but still seems to have the audio distortion issue up to this point and unfortunately, just as you've pointed out in the readme, no one seems to have documented this issue outside of this repository.

IceDBorn commented 1 year ago

https://bugzilla.mozilla.org/show_bug.cgi?id=1844181

IceDBorn commented 1 year ago

https://github.com/IceDBorn/pipewire-screenaudio/commit/952408dd513b47c20216f4a3cc7c108441eba58a

IceDBorn commented 1 year ago

Here's a WIP build of Firefox that fixes this issue.

edisionnano commented 1 year ago

Here's a WIP build of Firefox that fixes this issue.

That's cool, is there a list of PRs to watch?

IceDBorn commented 1 year ago

@edisionnano The attached files

IceDBorn commented 1 year ago

The audio pitching bug is now fixed in the nightly branch of Firefox. This is set to release to the stable branch on December 5th!

edisionnano commented 1 year ago

The audio pitching bug is now fixed in the nightly branch of Firefox. This is set to release to the stable branch on December 5th!

I'll keep the issue open until then, when it is released on the stable channel I'll close it and update the readme with a pr

PhantomShift commented 10 months ago

Bit late to point out because I forgot the exact date/update that the relevant fix would come in, but I can confirm that audio no longer seems to be distorted in screenshares. Weirdly, I still have the other issue mentioned of the stream audio getting played back to you on regular Firefox whereas the issue does not exist on developer edition (ironically however this helped me confirm on my end that the issue is fixed, as before the fix I could also hear the distortion in the playback). Not sure if it's a difference in configuration I've overlooked or if there's actually something different in the builds, but for now I'm continuing to stick with developer edition for convenience.

edisionnano commented 9 months ago

Are there 0 issues left on stable Firefox?

PhantomShift commented 7 months ago

From testing a bit earlier today audio seems to be working on normal Firefox with no audio looping back to myself.

edisionnano commented 6 months ago

Thank you