Differences between revisions 16 and 17
Revision 16 as of 2021-05-15 02:11:48
Size: 8980
Comment: minor wording change
Revision 17 as of 2021-05-15 03:09:07
Size: 8980
Editor: PaulWise
Comment: fix the word
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
is available. The libraries in this program allow applications directly is available. The libraries in this package allow applications directly

Translation(s): none


PipeWire is a server and API for handling multimedia on Linux. Its most common use is for Wayland and Flatpak applications to implement screensharing, remote desktop, and other forms of audio and video routing between different pieces of software. Per the official FAQ, "you can think of it as a multimedia routing layer on top of the drivers that applications and libraries can use."

As opposed to PulseAudio's focus on consumer audio and JACK's focus on professional audio, PipeWire aims to work for all users at all levels. Among other techniques, PipeWire achieves this with its ability to dynamically switch between different buffer sizes, for adapting to the different latency requirements of different audio applications.

In Debian 10, PipeWire 0.2.5 is available, and should not need to manually be installed, as it's usually brought in as a dependency by applications that make use of it.

In Debian 11, PipeWire 0.3.19 is available, and can be experimentally used as a substitute for the ALSA userspace library, PulseAudio, and JACK. This is a documented but unsupported usecase.


Installation

In its most basic form, PipeWire can be installed simply by installing the pipewire package.

In Debian 10, some plugins are split into separate packages. These can be found in the libspa-bluetooth and libspa-ffmpeg packages.

In Debian 11, there is no longer a separate FFmpeg plugin package, and the Bluetooth package has been moved to libspa-0.2-bluetooth. There is also a JACK plugin in the libspa-0.2-jack package, required for using PipeWire as a JACK server (as explained below).

For Debian 11, PipeWire can be used to replace PulseAudio. Additionally, the pipewire-audio-client-libraries package is available. The libraries in this package allow applications directly accessing JACK and ALSA to output via the PipeWire server, allowing harmonious interoperability between the different sound servers and APIs.


Configuration

Using as a substitute for PulseAudio/JACK/ALSA

Debian 11 (Bullseye) is currently unreleased and in development. These instructions apply for anyone using it as the current testing branch or anyone using Debian Sid/Unstable.

These instructions may not always be up-to-date or even functional at all. They also may change at any time.

As per Simon McVittie, the PipeWire package maintainer, "This is not a supported scenario for Debian 11, and is considered experimental."

It may break certain applications, lack certain functionality, or not work at all.

Users may also be interested in PipeWire's capacity to be a drop-in substitute for existing Linux audio solutions, including PulseAudio and JACK. Potential benefits include lower CPU usage, better support for Bluetooth devices, and better integration between applications using JACK and PulseAudio. This is the default behavior in some other distros, notably Fedora 34 and newer.

This behavior can be experimentally enabled in Debian 11.

The three instructional sections below are independent of eachother, but you are still highly recommended to use PipeWire to replace all of them if you intend to replace any of it, for the best integration between different applications.

For PulseAudio

In this scenario, PipeWire runs as a per-user audio service, replacing PulseAudio completely.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-pulseaudio

Create a pipewire-pulse service by copying the example files:

# cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /etc/systemd/user/

Run these three commands as your regular user (not as root):

// Check for new service files with:
systemctl --user daemon-reload
// Disable and stop the PulseAudio service with:
systemctl --user --now disable pulseaudio.service pulseaudio.socket
// Enable and start the new pipewire-pulse service with:
systemctl --user --now enable pipewire pipewire-pulse

You can check which server is in use by, as your regular user, running:

pactl info | grep '^Server Name'

If it's using PipeWire, the server name will be "PulseAudio (On PipeWire 0.3.19)"

Ensure this continues working after a reboot. If not, you may need to "mask" the PulseAudio service by running:

systemctl --user mask pulseaudio

This may require another reboot, after which PipeWire should be used exclusively, even following any more reboots. This will block the PulseAudio service from being activated outright. If you wish to restore previous functionality, you'll need to run the same command again with the "unmask" action.

For ALSA

ALSA clients can be configured to output via PipeWire.

Some may describe this as "replacing ALSA", but as the PipeWire FAQ clarifies: "No, ALSA is an essential part of the Linux audio stack, it provides the interface to the kernel audio drivers. That said, the ALSA user space library has a lot of stuff in it that is probably not desirable anymore these days, like effects plugins, mixing, routing, slaving, etc. PipeWire uses a small subset of the core ALSA functionality to access the hardware. All of the other features should be handled by PipeWire."

Install the pipewire-audio-client-libraries package, if not already installed.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-alsa

Copy a configuration file from the PipeWire examples into your ALSA configuration directory:

# cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/

For JACK

JACK clients can be configured to output via PipeWire instead of JACK.

Install the pipewire-audio-client-libraries package, if not already installed.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-jack

Either run JACK clients using the pw-jack wrapper, or copy:

# cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/

And run:

# ldconfig

This will replace the JACK server libraries with PipeWire's replacements at application runtime, by pointing the dynamic linker at the /usr/lib/x86_64-linux-gnu/pipewire-0.3/jack/ folder.

Bluetooth

PipeWire will generally work fine in conjunction with Bluez to supply high-quality audio to Bluetooth-enabled audio devices when used as a replacement for PulseAudio, with some caveats.

At minimum, you will need to install the libspa-0.2-bluetooth package, remove the pulseaudio-module-bluetooth package, and then either reboot your computer or restart the PipeWire services, otherwise device connections will fail with "Protocol not available".

PipeWire will attempt to choose the best possible codec by default. You can override this, and tweak many other related settings, in the /etc/pipewire/media-session.d/bluez-monitor.conf file. You can edit this directly, or store local per-user changes by copying the file to ~/.config/pipewire/media-session.d/bluez-monitor.conf and editing that instead.

Additionally, since the release of PipeWire 0.3.19, there have been numerous Bluetooth-related feature additions and bug fixes. Experienced Bullseye/Testing users may consider upgrading to the newer version of PipeWire that's in DebianExperimental to resolve these.


Known issues

The pacmd command fails with:

$ pacmd 
No PulseAudio daemon running, or not running as session daemon.

The pactl command should be roughly equivalent in terms of functionality and does work with a pipewire backend.


See also

Read the official Debian package documentation for using PipeWire as a replacement for other audio servers by viewing the /usr/share/doc/pipewire-audio-client-libraries/README.Debian file.


CategoryHardware | CategorySound | CategorySoftware