PipeWire

From Gentoo Wiki
Jump to:navigation Jump to:search
This page contains changes which are not marked for translation.

PipeWire is a low-latency, graph-based, processing engine and server, for interfacing with audio and video devices. It can be used to support use-cases currently handled by ALSA, PulseAudio, and/or JACK, and aims to improve handling of audio and video under Linux.

Note
Wayland systems use PipeWire to provide desktop portal functionality such as screen sharing and remote desktop.

Some key features of PipeWire include:

  • Minimal latency capture/playback of audio and video.
  • Real-time multimedia processing.
  • Multi-process architecture allowing multimedia content sharing between applications.
  • Seamless support for PulseAudio, JACK, ALSA, and GStreamer.
  • Applications sandboxing support with Flatpak, with a security model that facilitates interacting containerized applications.

Most applications - including e.g. Firefox - don't yet support PipeWire's native API. However, PipeWire can emulate PulseAudio, thus removing the need for a separate PulseAudio sound server. Refer to the "USE flags" section for details.

PipeWire currently ships a PipeWire daemon, an example session manager, tools to introspect and use the PipeWire daemon, a library to develop PipeWire applications and plugins, and the SPA (Simple Plugin API) used by both the PipeWire daemon and the PipeWire library.

PipeWire users will typically need to install and use WirePlumber for session/policy management functionality, such as volume management; refer to that page for details.

Installation

Kernel

KERNEL
Device Drivers --->
 <*> Sound card support Search for <code>CONFIG_SOUND</code> to find this item. --->
 <*> Advanced Linux Sound Architecture Search for <code>CONFIG_SND</code> to find this item. --->
 -*- Sound Proc FS Support Search for <code>CONFIG_SND_PROC_FS</code> to find this item.
 [*] Verbose procfs contents Search for <code>CONFIG_SND_VERBOSE_PROCFS</code> to find this item.

Desktop profiles

All desktop profiles now enable PipeWire by default, so no installation should be required.

systemd users need to enable the wireplumber service by following this section.

Non-desktop profiles

Note
If the system is planned to be used as a desktop then it is generally recommended to just enable a desktop profile. It's easier to disable the one or two USE flags the system doesn't require, rather adding 20 just to match what the desktop profile enables as standard for common system needs.

USE flags

To use PipeWire as a sound server, specify the sound-server USE flag on media-video/pipewire [1] .

Then, if using PipeWire as a replacement for the PulseAudio sound server:

  1. Ensure media-sound/pulseaudio-daemon is not installed. This is necessary to avoid issues resulting from running more than one sound server.
  2. Ensure media-libs/libpulse is installed, which will allow PipeWire to emulate a PulseAudio sound server. Not many applications currently support PipeWire's native API.
  3. Ensure the pulseaudio USE flag is still set globally.

If compiled with the dbus USE flag enabled, PipeWire requires the presence of a D-Bus session bus and an XDG-compliant environment. Both requirements should be met by a desktop profile; on such systems, starting PipeWire is as simple as running the pipewire binary. On other profiles, if using OpenRC, permissions requirements might also need the elogind USE flag on the media-video/wireplumber package, together with elogind itself.

D-Bus is required for Bluetooth support, interacting with RTKit to acquire real-time priorities, and interacting with other multimedia clients.[2] D-Bus is also used by KDE Plasma to notify PipeWire of volume changes.

To enable direct screencasting support on applications offering it, specify the screencast USE flag on the relevant packages. Otherwise, screencasting support may also be provided through the PulseAudio or JACK compatibility layers.

USE flags for media-video/pipewire Multimedia processing graphs

+man Build and install man pages
X Enable audible bell for X11
bluetooth Enable Bluetooth Support
dbus Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
echo-cancel Enable WebRTC-based echo canceller via media-libs/webrtc-audio-processing
elogind Enable session tracking via sys-auth/elogind
extra Build pw-cat/pw-play/pw-record
ffmpeg Enable ffmpeg/libav-based audio/video codec support
fftw Use FFTW library for computing Fourier transforms
flatpak Enable Flatpak support
gsettings Use gsettings (dev-libs/glib) to read/save used modules (useful for e.g. media-sound/paprefs
gstreamer Add support for media-libs/gstreamer (Streaming media)
ieee1394 Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
jack-client Install a plugin for running PipeWire as a JACK client
jack-sdk Use PipeWire as JACK replacement
libcamera Enable libcamera plugin via media-libs/libcamera
liblc3 Allow loading LC3 plugins via media-sound/liblc3
loudness Enable loudness normalisation according to the EBU R128 standard using media-libs/libebur128
lv2 Allow loading LV2 plugins via media-libs/lv2
modemmanager Combined with USE=bluetooth, allows PipeWire to perform telephony on mobile devices.
pipewire-alsa Install ALSA plugin, similar to media-plugins/alsa-plugins's USE=pulseaudio.
pulseaudio Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
readline Enable support for libreadline, a GNU line-editing library that almost everyone wants
roc Enable roc support for real-time audio streaming over the network, using media-libs/roc-toolkit. See https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Network#roc
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
sofa Spatially Oriented Format for Acoustics (SOFA) support via media-libs/libmysofa
sound-server Provide sound server using ALSA and bluetooth devices
ssl Enable raop-sink support (needs dev-libs/openssl)
system-service Install systemd unit files for running as a system service. Not recommended.
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
v4l Enable support for video4linux (using linux-headers or userspace libv4l libraries)
zeroconf Support for DNS Service Discovery (DNS-SD)
Data provided by the Gentoo Package Database · Last update: 2026年08月30日 17:11 More information about USE flags

Emerge

Once the USE flags have been specified, rebuild the affected packages:

root #emerge --ask --verbose --changed-use --update --deep @world

Alternatively, PipeWire may be emerged independently, though the previous method is usually what is required:

root #emerge --ask media-video/pipewire

Configuration

See also
Detailed, non Gentoo-specific, configuration documentation can be found at project's official site.
Tip
Typically, things work reasonably well out of the box, and PipeWire's system-level configuration is usually best left unmodified. Those moving to PipeWire from other audio systems, such as ALSA or PulseAudio, should consider moving configuration files for those systems - e.g. asoundrc files, ~/.config/pulse, etc. - to a location where they won't potentially create conflicts within the Linux audio subsystem, but where their contents are still available for reference and use if needed.

PipeWire recognizes multiple environment variables that allow settings to be changed, either per-user, or for individual commands: for example, PIPEWIRE_RUNTIME_DIR, PIPEWIRE_MODULE_DIR, and DISABLE_RTKIT. Refer to the pipewire(1) man page for a complete list.

Audio groups

It's recommended that users are in the pipewire group.

root #usermod -aG pipewire larry

PipeWire's default configuration tries to use realtime scheduling to increase audio thread priorities. If the user doesn't have the necessary permissions for this, the configuration will try to use RealtimeKit (RTKit) instead, such that sys-auth/rtkit will need to be installed. This behavior is defined under the context.modules portion of PipeWire's configuration.

root #emerge --ask sys-auth/rtkit

In general, for the best experience with fast user switching, users should not be in the audio group, in order to avoid a user application being able to take exclusive control of the audio device. Exceptions include systems that use seatd or that rely on the audio group for device access control / ACLs.

To remove a user from the audio group:

root #usermod -rG audio larry

Sound server configuration

Tip
SDDM users should make sure to start it up via the proper service or XDG_RUNTIME_DIR may not be set up correctly.

File locations

Use pw-config to output the current configuration paths, and use pw-config list to list the current configuration.

The default configuration should be fine for most users. This configuration is described in /usr/share/pipewire/pipewire.conf.

If customization is required, do not modify that file. Instead, copy it to either or both of:

  • /etc/pipewire/, for system-wide configuration; or
  • ${XDG_CONFIG_HOME}/pipewire/, for per-user configuration,

and modify either or both of those files as appropriate.

By default, XDG_CONFIG_HOME is ~/.config/. Refer to the XDG/Base_Directories page for further information.

Configuration fragments

Configuration fragments can be specified via a file with a .conf extension (e.g. 90-local.conf) in the following directories[3] :

  1. /usr/share/pipewire/pipewire.conf.d/
  2. /etc/pipewire/pipewire.conf.d/
  3. ${XDG_CONFIG_HOME}/pipewire/pipewire.conf.d/

User services

User services are available for both systemd and OpenRC. Those not using systemd or OpenRC can instead use PipeWire/gentoo-pipewire-launcher.

systemd

PipeWire provides socket and service files when built with the systemd USE flag.

If the PulseAudio user service is enabled, disable it; this is safe to do even if the user service was not in use.

user $systemctl --user disable --now pulseaudio.socket pulseaudio.service

While PipeWire does not appear to utilize the ~/.config/pulse/ directory beyond the cookie file, it may be a good idea to rename or delete it.

Enable the pipewire-pulse socket; enabling the pipewire-pulse socket will cause the pipewire-pulse service to be started if required. That service will in turn start the pipewire service.

user $systemctl --user enable --now pipewire-pulse.socket

Socket activation means the pipewire service will only be started when required, which is usually sufficient. However, the pipewire service can be always started when the user logs in by enabling pipewire.service:

user $systemctl --user enable --now pipewire.service

Enable the wireplumber service:

user $systemctl --user enable --now wireplumber.service

In these cases, the --now flag is optional, but probably safe to use, as starting PipeWire with default configuration merely allows using new interfaces and doesn't change the existing ones, i.e. non-PipeWire clients continue using the same libraries and services they were using previously.

OpenRC

OpenRC has built-in and enabled by default support for user services since version 0.60. Similarly to systemd, they can be used to automatically launch and stop PipeWire on login and logout.

To enable the PipeWire services run:

user $rc-update add -U pipewire default
user $rc-update add -U pipewire-pulse default
user $rc-update add -U wireplumber default

To start the services without enabling them:

user $rc-service --user pipewire start
user $rc-service --user pipewire-pulse start
user $rc-service --user wireplumber start

PulseAudio server emulation

To confirm PulseAudio server emulation:

user $LANG=C pactl info | grep "Server Name"
Server Name: PulseAudio (on PipeWire 0.3.39)

Multi-user support

Multi-user support requires the UNIX socket interface.

If there is not yet a pipewire-pulse.conf file in /etc/pipewire/, add it (creating the /etc/pipewire/ directory if necessary):

root #cp /usr/share/pipewire/pipewire-pulse.conf /etc/pipewire/

Then edit /etc/pipewire/pipewire-pulse.conf to specify the UNIX socket location, which must match the PulseAudio client configuration:

FILE /etc/pipewire/pipewire-pulse.confPulseAudio UNIX socket
pulse.properties = {
 server.address = [
 "unix:/tmp/pulse-socket"
 ]
}

Advanced

For information about more advanced PipeWire configuration, refer to the PipeWire/extra page.

Usage

A command-line interface to PipeWire is provided by pw-cli(1) . This tool can be used to e.g. list the IDs of PipeWire nodes:

user $pw-cli ls Node

and to check the current properties of a given node:

user $pw-cli e <node-id> Props

Controlling the volume

Ways to control the volume - which on typical setups will be managed by WirePlumber - include:

user $pw-cli s <node-id> Props '{ mute: false, channelVolumes: [ 0.3, 0.3 ] }'

Checking settings

pw-metadata can be used to check the current sample rate and other settings:

user $pw-metadata -n settings
Found "settings" metadata 31
update: id:0 key:'log.level' value:'2' type:''
update: id:0 key:'clock.rate' value:'192000' type:''
update: id:0 key:'clock.allowed-rates' value:'[ 192000, 48000, 44100 ]' type:''
update: id:0 key:'clock.quantum' value:'1024' type:''
update: id:0 key:'clock.min-quantum' value:'32' type:''
update: id:0 key:'clock.max-quantum' value:'2048' type:''
update: id:0 key:'clock.force-quantum' value:'0' type:''
update: id:0 key:'clock.force-rate' value:'0' type:''

If PipeWire is being used as a PulseAudio backend, the sample rate and bit depth, or Default Sample Specification, can be checked with:

user $pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 213
Tile Size: 65472
User Name: larry
Host Name: gentoo
Server Name: PulseAudio (on PipeWire 0.3.71)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 192000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.usb-Generic_USB_Audio-00.pro-output-2
Default Source: alsa_input.usb-Focusrite_Scarlett_Solo_USB-00.pro-input-0

GUI patchbays

GUI patchbays available via the gentoo repository include:

Additionally, coppwr is a low-level patchbay available via Flatpak (io.github.dimtpap.coppwr).

Advanced

For information about more advanced PipeWire usage, refer to the PipeWire/extra page.

Replacing JACK

If the jack-sdk USE flag is enabled, PipeWire can be used as the server for JACK clients; calls to the JACK API will be translated into calls to PipeWire's native API. Clients can be connected via a patchbay interface such as qjackctl(1) . Refer to pipewire-jack.conf(5) for information about configuring PipeWire for JACK clients.

When PipeWire is configured this way, the media-sound/jack2 package must be uninstalled; /usr/lib/libjack.so will be owned by the media-video/pipewire package. This can be checked via e.g. qfile (provided by app-portage/portage-utils ) or equery (provided by app-portage/gentoolkit ).

If the jack-sdk USE flag is not enabled, media-sound/jack2 will be installed (and its dbus USE flag must be enabled). In this case, individual JACK clients can be run via pw-jack(1) , e.g. pw-jack qjackctl. When using pw-jack, do not use either jackd(1) nor jackdbus.

Not every client will necessarily work; some may even ungracefully exit due to missing symbols. Re-configuration of JACK clients might be required.

Important
Existing JACK users are likely to have realtime capability set up, but new users are advised to raise the value of RLIMIT_MEMLOCK from 64k (Gentoo's default) to 256k for all PipeWire users that want JACK emulation; refer to the "Clients unable to lock memory" section. Failure to do this will likely cause at least occasional buffer underruns (xruns), as a single page fault is likely to spend half to the entire length of a buffer just in kernel time to resolve.

Troubleshooting

Refer to PipeWire/troubleshooting.

See also

External resources

References