Screensharing, Wayland, Pipewire, and Discord. Choose three.
As I mentioned in my last post, I'm finally jumping ship from Windows on my last holdout device, my personal desktop. Since I have a couple more of these posts in the works, I'll turn this into a mini series documenting the sharp corners & edge-cases I run into while assimilating my "just works" machine into my NixOS fleet.
I screenshare my desktop frequently via Discord to host watchalong/watch-together events with friends (to watch our favorite idols, of course). I've always used my windows install for this, because troubleshooting audio issues with 20 others waiting on you to start streaming is the opposite of a good time for anyone. Discord has made advancements in the last year or two with their linux client, even properly supporting screen caputre of Wayland desktops and applications--at least in KDE. Capturing audio, however, never worked.
The reason is dumb, but here's some info about my environment for reference:
- OS: NixOS 25.05 on kernel 6.12.50
- DE: KDE Plasma 6 (Wayland)
- Pipewire: 1.4.7
- PulseAudio: 17.0
- mpv: v0.40.0
- Discord: stable 468244 (aeb7f87) - 0.0.111 x64
The Discord client can't capture audio from Wayland applications that use Pipewire as their audio backend.
I jumped on the Pipewire bandwagon years ago when it became the default on Fedora, and overall have been very happy with it. I love having a unified interface for audio applications, and creating real-time audio processing filters for my microphone input (post coming soon) has been awesome! The Discord client itself happily accepts the output of my Pipewire mic filter chain (probably because it's exposed as an ALSA device...) but will not pick up audio from Pipewire-native applications. Most applications like Firefox or Spotify still use PulseAudio, but mpv defaults to Pipewire if it's available.
This drove me absolutely mad.
Luckily mpv has a simple workaround. Passing --ao pulse on the command line or setting ao = pulse in mpv.conf instructs mpv to use its PulseAudio backend, and Discord's screenshare on Wayland will pick it up just fine.
Here's a quick way to check what backend your application is using if you're running Pipewire. null == Pipewire:
|
|
Alternative Discord clients like webcord and vencord's vesktop supposedly solve this in their own ways. If you use other applications natively running on Pipewire that don't have a fallback option to PulseAudio, they may be a good alternative for you. Technically using them violates the ToS, so hopefully the official client will support capturing Pipewire audio in the near future.