PipeWire

From ArchWiki
(Redirected from Pipewire)
Jump to navigation Jump to search

PipeWire is a rather new multimedia framework by GNOME. The main developer is Wim Taymans.

PipeWire supports containers like Flatpak and does not rely on user groups audio and video, but rather 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 (or the pipewire-gitAUR package from the AUR).

The package installs systemd unit files for the service itself and automatic socket activation (which means it will autostart).

systemctl --user status pipewire.socket
systemctl --user status pipewire.service

Optionally, install pipewire-docs for documents. 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-pulseAUR, and lib32-pipewire-jackAUR for multilib support.

Usage

WebRTC screen sharing

Most browsers used to rely on X11 for capturing the desktop (or apps) when using WebRTC (e.g. on google Hangouts); because Gnome shell uses Wayland by default on Arch when started by GDM, desktop sharing is basically broken, but pipewire is going to provide support for this usecase under Wayland.

This requires Pipewire and xdg-desktop-portal to be installed; Firefox 68 will support PipeWire with a custom patch from fedora, and on Chromium (73+) you need to enable WebRTC PipeWire support the following url in a chromium tab:

chrome://flags/#enable-webrtc-pipewire-capturer

Note that since Chrome(ium) is currently using pipewire 0.2 whereas Arch ships pipewire 0.3, you also need to install libpipewire02 for screen sharing to work.

Warning: Since this pull request was merged following note about specific app/window sharing may be not correct anymore

Note that the only supported feature is sharing the entire desktop and not a specific app/window due to missing implementation in xdg-desktop-portal.

Video

Although the software is not yet production ready, it is safe to play around with. Most application that rely on GStreamer to handle e.g. video streams should work out-of-the-box due to the PipeWire GStreamer plugin. Applications like e.g. cheese are therefore already able to share video input using it.

Audio (JACK)

Support for the JACK API on top of PipeWire is implemented and first applications relying on said interface are working in a test environment. Through that work one is able to achieve the low latency needed for pro-audio with PipeWire.

A detailed description of how to enable and use it can be found here.

ALSA/Legacy applications

Work on ALSA emulation is ongoing but first working code exists.

Bluetooth

PipeWire provides a bluetooth module that integrates directly into the Bluez Bluetooth framework. Pairing and management hence works the same since it is handled by higher level interfaces.

Drop-in replacement for PulseAudio/Jack (Experimental)

PipeWire provides a PulseAudio compatible server implementation and ABI-compatible libraries for JACK clients.

See this blog entry for more information on testing PipeWire.

Replacing PulseAudio

Install pipewire-pulse and enable pipewire-pulse.socket for the systemd user session.

For Bluetooth devices to work, also edit /etc/pipewire/pipewire.conf and append -e bluez5 to the exec /usr/bin/pipewire-media-session line:

/etc/pipewire/pipewire.conf
...
exec /usr/bin/pipewire-media-session -e bluez5
...

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)
...

Replacing JACK

Install pipewire-jack-dropinAUR to let JACK clients load the compatible libraries instead of the original libjack*.

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)

Also, if you need multilib support, there is lib32-pipewire-jack-dropinAUR.

Troubeshooting

Crackling sound in CS:GO

The default length of the CS:GO sound buffer (which is essentially the audio latency) is 0.025 seconds. For some hardware, this is too low, so crackling audio may happen. PulseAudio does not have this problem, because it increases the buffer size automatically when a buffer xrun is detected. PipeWire doesn't do this and probably won't do this. The discussion on how to fix it is ongoing.

Currently, the workaround is to open the in-game console by pressing the ` key (the key to the left of 1), and enter snd_mixahead 0.03. You can experiment with the value to find a suitable one.

Related issue: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/401

Reference: https://csgoguru.com/improve-your-csgo-sound-settings/

See also