PipeWire

From Alpine Linux
Revision as of 16:56, 4 January 2021 by Govynnus (talk | contribs) (make->may)
This material is work-in-progress ...

The instructions below have not been thoroughly tested and may break things.
(Last edited by Govynnus on 4 Jan 2021.)

PipeWire is a multimedia processing engine that aims to improve audio and video handling on Linux.

Prerequisites

Audio Group

Add your normal user to the audio group. The user must log in for this to take effect.

# addgroup audio <user>

D-Bus

PipeWire requires a running D-Bus session. If you use a full desktop environment this will probably be started automatically, but with minimal window managers it must be done manually.

# apk add dbus dbus-openrc dbus-x11
# rc-service dbus start
# rc-update add dbus default
Note: You may need to install dbus from the edge repository, but I'm not entirely sure.

Then use dbus-launch whenever you start an X or Wayland session. For example:

$ dbus-launch --exit-with-session sway

Installation and configuration

Install pipewire. It might be a good idea to use the edge version because it's more up-to-date and PipeWire is still under development.

# apk add pipewire pipewire-doc

Pulseaudio

PipeWire can run a Pulseaudio daemon which should allow all existing Pulseaudio applications to be used with the PipeWire backend.

# apk add pipewire-pulse

To enable the Pulseaudio daemon edit /etc/pipewire/pipewire.conf and uncomment the following line:

exec /usr/bin/pipewire-pulse

Jack

If you will be using PipeWire for Jack applications install the required package and make system wide links to the PipeWire replacement Jack libraries (I have not had success using pw-jack). You will not need to start a Jack server.

# apk add pipewire-jack
# ln -sf /usr/lib/pipewire-0.3/jack/libjackserver.so.0 /usr/lib/libjackserver.so.0
# ln -sf /usr/lib/pipewire-0.3/jack/libjacknet.so.0 /usr/lib/libjacknet.so.0
# ln -sf /usr/lib/pipewire-0.3/jack/libjack.so.0 /usr/lib/libjack.so.0
Note: These symlinks might be overwritten during updates.

Video

Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and GStreamer applications.

Screen sharing on Wayland

Not got this working yet. Take a look at xdg-desktop-portal.

Usage

Start the PipeWire media server. You'll probably get quite a few errors but just ignore them for now.

$ pipewire

In a different terminal window check the default output device. I don't yet know how this default can be changed for all applications, so you'd better hope it's right!

$ pw-cat -p --list-targets

Test sound is working using an audio file in a format supported by libsndfile (e.g. flac, opus, ogg, wav).

$ pw-cat -p test.flac

If you have a microphone test recording audio is working.

$ pw-cat -r --list-targets
$ pw-cat -r recording.flac
(Speak for a while then stop it with Ctrl+c)
$ pw-cat -p recording.flac

Test Pulseaudio clients using a media player (most use Pulseaudio) and if you use Jack test that too:

# apk add jack-example-clients
$ jack_simple_client

You should hear a sustained beep.

Note: The fact that jack_simple_client works doesn't mean all Jack clients will. For example, I can't hear anything from ardour6.

If you are happy everything is working, make pipewire start automatically when your X or Wayland session starts. For example, you could add the pipewire command to ~/.xinitrc or your window manager's config file.

See Also