PipeWire
PipeWire is a new low-level multimedia framework. It aims to offer capture and playback for both audio and video with minimal latency and support for PulseAudio-, JACK-, ALSA- and GStreamer-based applications.
The daemon based on the framework can be configured to be both an audio server (with PulseAudio and JACK features) and a video capture server.
PipeWire also supports containers like Flatpak and does not rely on audio and video user groups but rather it uses a Polkit-like security model asking Flatpak or Wayland for permission to record screen or audio.
Installation
Install the pipewire package from the official repositories.
Pipewire uses Systemd/User for management of the server and automatic socket activation. See the respective Systemd/User for more details on the startup behavior and logging of the service.
Optionally, install pipewire-docs to review the documentation. Other packages, such as pipewire-alsa, pipewire-pulse, and pipewire-jack are normally not needed unless one wants to use PipeWire as a PulseAudio/JACK replacement. Also available are lib32-pipewireAUR, lib32-pipewire-pulse-gitAUR[broken link: package not found], and lib32-pipewire-jackAUR for multilib support.
Usage
WebRTC screen sharing
Most browsers used to rely on X11 for capturing the desktop (or individual applications) when using WebRTC (e.g. on Google Hangouts). On Wayland, the sharing mechanism is handled differently for security reasons. PipeWire enables sharing content under Wayland with fine-grained access controls.
This requires xdg-desktop-portal and one of its backends to be installed. The available backends are:
- xdg-desktop-portal-gtk for GNOME.
- xdg-desktop-portal-kde for KDE.
- xdg-desktop-portal-wlr for wlroots-based compositor (e.g. Sway, dwl)
Firefox (84+) supports this method by default, while on Chromium (73+) one needs to enable WebRTC PipeWire support by setting the corresponding (experimental) flag at the following URL
chrome://flags/#enable-webrtc-pipewire-capturer
For xdg-desktop-portal-wlr
to work you need to install pipewire-media-session [1] and set XDG_CURRENT_DESKTOP
[2]:
export XDG_CURRENT_DESKTOP=sway
xdg-desktop-portal-wlr
if you have more than one, you can add the --output=Monitor
flag to it by editing the ExecStart=
option in the unit's service file. The complete line could look like ExecStart=@libexecdir@/xdg-desktop-portal-wlr --output=eDP-1
Note that the only supported feature is sharing the entire desktop and not a specific app/window [4][5].
Video
Although the software is not yet production-ready, it is safe to play around with. Most applications that rely on GStreamer to handle e.g. video streams should work out-of-the-box thanks to the PipeWire GStreamer plugin. Applications like e.g. cheese are therefore already able to share video input using it.
Audio
PipeWire can be used as an audio server, similar to PulseAudio and JACK. It aims to replace both PulseAudio and JACK, by providing a PulseAudio-compatible server implementation and ABI-compatible libraries for JACK clients. See this blog entry for more information.
ALSA/Legacy applications
Install pipewire-alsa to route all application using the ALSA API through PipeWire.
PulseAudio clients
Install pipewire-pulse. It will replace pulseaudio and pulseaudio-bluetooth. Normally, no further action is needed, as the user service pipewire-pulse.socket
should be enabled automatically by the package. If PipeWire does not work correctly on system startup, validate that the user services pipewire-pulse.service
, pipewire.service
, and pipewire-media-session.service
are up and running. See Systemd/User.
Reboot or re-login to see the effect.
To check if the replacement is working, run the following command and see the output:
$ pactl info
... Server Name: PulseAudio (on PipeWire 0.3.16) ...
JACK clients
Install pipewire-jack and use pw-jack
to launch JACK clients with the compatible libraries instead of the original libjack*
:
pw-jack application
It's also possible to request a custom buffer size by setting a quotient of buffersize/samplerate (which equals the block latency in seconds):
PIPEWIRE_LATENCY="128/48000" pw-jack application
Alternatively, install pipewire-jack-dropinAUR or uninstall jack/jack2 to let JACK clients load the compatible libraries automatically.
Use ldd
to verify that the JACK application links to the correct library:
$ ldd /usr/bin/qjackctl | grep -i libjack
libjack.so.0 => /usr/lib/pipewire-0.3/jack/libjack.so.0 (0x00007f7e5080a000)
Bluetooth devices
PipeWire handles Bluetooth audio devices if the pipewire-pulse package is installed. More specifically, the media session daemon checks for /etc/pipewire/media-session.d/with-pulseaudio
, and enables its bluez5
module automatically if the file exists.
Run PipeWire on top of native JACK
PipeWire can also run as a JACK client on top of the native JACK daemon if desired. See JACK and PipeWire for more information.
Audio post-processing
PulseEffects
PulseEffects is a GTK utility which provides a large array of audio effects and filters to individual application output streams and microphone input streams. Notable effects include an input/output equalizer, output loudness equalization and bass enhancement, and input de-esser and noise reduction plug-in. See the GitHub page for a full list of effects.
In order to use PulseEffects with PipeWire, install pulseeffects or pulseeffects-gitAUR.
See Community Presets for a collection of preset configurations.
Troubleshooting
Microphone is not detected by PipeWire
PipeWire's alsa-monitor
module uses alsa-card-profiles to detect devices by default. If this is not working for you, try to turn off api.alsa.use-acp
, or optionally turn on api.alsa.use-ucm
in /etc/pipewire/media-session.d/alsa-monitor.conf
, under rules
-> the first rule -> actions
-> update-props
:
... update-props = { api.alsa.use-acp = false ...
Then, restart pipewire and check available devices:
$ pw-record --list-targets
Available targets ("*" denotes default): 62 58: description="Built-in Audio" prio=1872 60: description="Built-in Audio" prio=2000 * 62: description="Built-in Audio (Loopback PCM)" prio=1984
No sound after connecting to Bluetooth device
As of 2020-12-07, if there is no sound after connecting a Bluetooth device, you might need to switch the default sink and/or move a sink input to the correct sink. Use pactl list sinks
to list the available sinks and pactl set-default-sink
to switch the default sink to the Bluetooth device. This can be automated via udev using a script similar to this one.
See this Reddit thread for a discussion of the issue. According to author of the script, the headset profile (HSP) might still have problems.
Low volume
After replacing PulseAudio with Pipewire, sound worked fine, but after a reboot, the volume was intolerably low.
Open alsamixer
, use F6
to select the proper soundcard, and make sure the ALSA volumes are at 100%. alsactl
should maintain this setting after reboot.
Increasing RLIMIT_MEMLOCK
Dec 13 11:11:11 HOST pipewire-pulse[99999]: Failed to mlock memory 0x7f4f659d8000 32832: This is not a problem but for best performance, consider increasing RLIMIT_MEMLOCK
Install realtime-privileges and add your own user to the realtime
group.
Alternatively, increasing memlock from 64kB to 128kB seems enough to fix this. If you are running pipewire-pulse
under systemd/User, add:
username soft memlock 64 username hard memlock 128
to /etc/security/limits.d/username.conf
Changing the sample rate
By default PipeWire sets a global sample rate of 48kHz. If you need to change it (e.g. you own a DAC supporting a higher value) you can do it by editing the line default.clock.rate = 48000
in the configuration file /etc/pipewire/pipewire.conf
. For example, if you want 192kHz, uncomment and change value 48000
to default.clock.rate = 192000
.
External sound card not activated after reconnect
Check ~/.config/pipewire-media-session/default-profile
if there is any entry with default profile "off" and remove it. If that does not help, remove all files from ~/.config/pipewire-media-session/
and restart PipeWire using systemctl --user restart pipewire.service
.
No Sound or pactl info shows Failure: Connection refused
It means applications are unable to connect to the PipeWire-Pulse service, confirm that /etc/pipewire/pipewire-pulse.conf
exists and is not empty and restart PipeWire-Pulse using systemctl --user restart pipewire-pulse.service
.
If that does not fix it, run strace -f -o /tmp/pipe.txt pactl info
and pastebin /tmp/pipe.txt
while seeking help on IRC (Freenode #pipewire) or the mailing-lists.
Low audio quality on Bluetooth
Feb 17 18:23:01 HOST pipewire[249297]: (bluez_input.18:54:CF:04:00:56.a2dp-sink-60) client too slow! rate:512/48000 pos:370688 status:triggered
In case Bluetooth playback stutters, check pipewire.service
using systemctl --user status pipewire.service
. If there are errors like this one, check the currently selected codec using pactl list sinks
and try changing it by setting bluez5.codecs
to one of sbc aac ldac aptx aptx_hd
in /etc/pipewire/media-session.d/bluez-monitor.conf
and restart PipeWire using systemctl --user restart pipewire.service
for the changes to take effect.
/etc/pipewire/media-session.d/bluez-monitor.conf
... properties = { ... bluez5.codecs = [sbc] ...
No devices detected after PipeWire update and reboot (git / >=0.3.23)
As of commit 012a68f8[6] new systemd service has been added and it's disabled by default which means there is no pipewire-media-session
running on the system reboot. To enable service run: systemctl --user enable --now pipewire-media-session.service
If user or package manager have not sorted out configuration files changes after update then another instance of pipewire-media-session
might be running in pipewire.service, to check run: systemctl --user status pipewire.service
If it shows pipewire and pipewire-media-session running thus update your system and/or user configuration:
/etc/pipewire/pipewire.conf and/or ~/.config/pipewire/pipewire.conf
context.exec = { ... # Line below should be commented out #"/usr/bin/pipewire-media-session" = { args = "" } ... }
Noticeable audio delay when starting playback
This is caused by node suspension when inactive. It can be disabled by editing /etc/pipewire/media-session.d/*-monitor.conf
depending on where the delay occurs and changing property session.suspend-timeout-seconds
to 0 to disable or to experiment with other values and see what works. Alternatively you can comment out the line suspend-node
in /etc/pipewire/media-session.conf
. Restart both the pipewire
and pipewire-pulse
systemd services to apply these changes, or alternatively reboot.
Audio cutting out when multiple streams start playing
This problem can typically be diagnosed by running journalctl --user -b -u pipewire-pulse
and finding lines similar to:
pipewire-pulse[21740]: pulse-server 0x56009b9d5de0: [Nightly] UNDERFLOW channel:0 offset:370676 underrun:940
According to the official PipeWire troubleshooting guide, to solve this problem edit /etc/pipewire/media-session.d/alsa-monitor.conf
, uncomment the line saying api.alsa.headroom = 0
and change its value to 1024
.
See also
- Wiki — PipeWire Wiki on Freedesktop GitLab
- Pipewire Update Blog Post — Blog post from January 2018 outlining the state of PipeWire at the time
- PipeWire Late Summer Update 2020 — Blog post from September 2020