PipeWire: Difference between revisions
m (make->may) |
Prabuanand (talk | contribs) (simplified the section and made it consistent.) |
||
(91 intermediate revisions by 27 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{TOC right}} | ||
[https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux. | [https://pipewire.org/ PipeWire] is a multimedia processing engine that aims to improve audio and video handling on Linux. Pipewire can act as a replacement for both [[PulseAudio]] and [[ALSA]] servers. | ||
== Prerequisites == | == Prerequisites == | ||
PipeWire requires a running [[D-Bus]] system and/or session bus for most of its functionality. If you start session-wide dbus instance, make sure to start PipeWire in that same session. | |||
PipeWire needs proper permissions to access devices. If [[Elogind|elogind]] is used, no further configuration is required. Otherwise, the user should be in <code>audio</code> (to access audio devices) and <code>video</code> (to access webcam devices) groups. Make sure to re-login for these changes to take effect: {{Cmd|<nowiki># addgroup <user> audio | |||
# addgroup <user> video</nowiki>}} | |||
< | {{Warning|Membership of the <code>video</code> group will also grant unrestricted access to video devices, which is often a security issue. See issue {{issue|15409}} for further details. }} | ||
# | |||
== Installation == | |||
The following packages i.e {{Pkg|pipewire}} and {{Pkg|wireplumber}} a session manager are the minimum required packages for getting pipewire to work.{{Cmd|# apk add pipewire wireplumber}} | |||
=== Pulseaudio interface === | |||
The package {{Pkg|pipewire-pulse}} allows pulseaudio applications to use PipeWire as audio server in the backend. {{Cmd|# apk add pipewire-pulse}} | |||
=== | === JACK compatibility === | ||
Since Pipewire replaces JACK, Install {{Pkg|pipewire-jack}} package, so it provides ABI-compatible libraries for JACK applications.{{Cmd|# apk add pipewire-jack}} | |||
=== ALSA support === | |||
{{ | Install {{Pkg|pipewire-alsa}} package to provide support for Alsa applications.{{Cmd|# apk add pipewire-alsa}} | ||
=== GUI tools === | |||
{{Pkg|pavucontrol}} or {{Pkg|pavucontrol-qt}} package provides a simple GUI app for controlling sound, outputs, etc. To use <code>pavucontrol</code> tool install {{Pkg|pipewire-pulse}} as the tool still needs [[#Pulseaudio interface|Pulseaudio Interface]]. The XFCE Audio mixer can also be used to help control volume by installing the package {{pkg|xfce4-mixer}} which is currently in available in [[Repositories#Testing|testing]] repository. | |||
''{{Pkg|qpwgraph}}''' is a graph manager dedicated to PipeWire with Qt GUI Interface. | |||
== Configuration == | |||
PipeWire and WirePlumber store their default configuration in {{Path|/usr/share/pipewire}} and {{Path|/usr/share/wireplumber}} respectively. If you want to edit the configuration, you need to move it to {{Path|/etc}}: | |||
{{Cmd|<nowiki># cp -a /usr/share/pipewire /etc | |||
# cp -a /usr/share/wireplumber /etc</nowiki>}} | |||
=== pipewire-launcher === | |||
Start the PipeWire media server using the <code>pipewire-launcher</code> script provided by Alpine Linux. You'll probably get quite a few errors but just ignore them for now. {{Cmd|$ /usr/libexec/pipewire-launcher}} | |||
If .xinitrc is used, add {{Path|/usr/libexec/pipewire-launcher}} to your {{Path|~/.xinitrc}}. | |||
If you do not use GUI by default, add the following stanza to your shell configuration file:{{Cmd|export $(dbus-launch) | |||
/usr/libexec/pipewire-launcher}} | |||
{{Tip|You can also use <code>superd</code> to manage <code>pipewire</code> and its related services.}} | |||
=== Screen sharing on Wayland === | |||
You will need the right [https://github.com/flatpak/xdg-desktop-portal xdg-desktop-portal] backend for your desktop environment. Screen sharing is known to work on: | |||
* GNOME with <code>xdg-desktop-portal-gtk</code> | |||
* KDE Plasma with <code>xdg-desktop-portal-kde</code> and Firefox | |||
</ | * Sway with <code>xdg-desktop-portal-wlr</code> and Firefox, see [[Sway]] for details | ||
{{ | === Bluetooth audio === | ||
{{Main|Bluetooth}} | |||
* Enable PulseAudio support as described above | |||
* Install bluetooth service packages: <code>bluez bluez-openrc pipewire-spa-bluez</code> | |||
* Optional: install GUI manager for bluetooth <code>blueman</code> | |||
* Enable and start bluetooth service: <code>rc-update add bluetooth; rc-service bluetooth start</code> | |||
* Restart PipeWire | |||
* Use commandline program <code>bluetoothctl</code> or GUI program <code>blueman-manager</code> to scan and pair bluetooth audio devices. | |||
* Use pavucontrol to adjust volume and manually select high definition bluetooth codecs. | |||
=== Video === | === Video === | ||
Line 69: | Line 73: | ||
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications. | Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and [https://gstreamer.freedesktop.org/ GStreamer] applications. | ||
=== | === Realtime scheduling === | ||
For realtime scheduling, it is recommended to use {{Pkg|rtkit}}. Add your user to the <code>rtkit</code> group. | |||
Alternatively, ensure your user has the right ulimit permissions. Since pipewire 0.3.66, you can add yourself to the <code>pipewire</code> group. You generally need (e.g. in {{Path|/etc/security/limits.conf}}): | |||
<pre> | <pre> | ||
@pipewire - memlock 4194304 | |||
@pipewire - nice -19 | |||
@pipewire - rtprio 95 | |||
</pre> | </pre> | ||
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with pipewire since 0.3.66, so if you have a [[PAM]] login session and add yourself to the pipewire group, you don't have to do anything else. Note that the above {{Path|/etc/security/limits.conf}} will only work if your session is using [[PAM]]. | |||
=== Disable D-Bus support === | |||
{{Warning|This section is no longer supported since Alpine 3.19 as Using lua for configuration files is no longer supported in version 0.5.}} | |||
For certain configurations (e.g. only audio playback and recording) D-Bus setup is not necessary and it can be disabled as follows. | |||
Edit the following configuration parameters: | |||
{{Cat|/etc/pipewire/pipewire.conf|<nowiki>context.properties = { | |||
... | |||
support.dbus = false | |||
}</nowiki>}} | |||
{{Cat|/etc/wireplumber/wireplumber.conf|<nowiki>context.properties = { | |||
... | |||
support.dbus = false | |||
}</nowiki>}} | |||
{{Cat|/etc/wireplumber/bluetooth.lua.d/50-bluez-config.lua|<nowiki>bluez_monitor.properties = { | |||
... | |||
["with-logind"] = false, | |||
}</nowiki>}} | |||
{{Cat|/etc/wireplumber/main.lua.d/50-alsa-config.lua|<nowiki>alsa_monitor.properties = { | |||
... | |||
["alsa.reserve"] = false, | |||
}</nowiki>}} | |||
< | {{Cat|/etc/wireplumber/main.lua.d/50-default-access-config.lua|<nowiki>default_access.properties = { | ||
$ pw-cat - | ... | ||
</ | ["enable-flatpak-portal"] = false, | ||
}</nowiki>}} | |||
== Testing == | |||
Use the <code>wpctl</code> utility from {{pkg|WirePlumber}} to test the working of pipewire: {{Cmd|$ wpctl status}} | |||
=== pw-cat playback === | |||
Test sound is working using an audio file in a format supported by [http://www.mega-nerd.com/libsndfile/ libsndfile]{{insecure url|Server refuses HTTPS connections}} (e.g. flac, opus, ogg, wav). Use <code>pw-cat</code> utility from {{Pkg|pipewire-tools}}: | |||
{{Cmd|$ pw-cat -p test.flac | |||
$ pw-play /usr/share/sounds/alsa/Front_Center.wav | |||
}} | |||
=== pw-cat recording === | |||
If you have a microphone test recording | If you have a microphone test audio recording is working. | ||
{{Cmd|$ pw-cat -r --list-targets | |||
$ pw-cat -r --list-targets | |||
$ pw-cat -r recording.flac | $ pw-cat -r recording.flac | ||
(Speak for a while then stop it with Ctrl+c) | (Speak for a while then stop it with Ctrl+c) | ||
$ pw-cat -p recording.flac | $ pw-cat -p recording.flac | ||
</ | }} | ||
=== PulseAudio === | |||
Test PulseAudio clients using a media player, as most use PulseAudio. | |||
=== JACK === | |||
Use <code>jack_simple_client</code> from {{Pkg|jack-simple-clients}}: | |||
{{Cmd|$ jack_simple_client}} | |||
You should hear a sustained beep. | |||
== Troubleshooting == | |||
=== `wpctl status` shows no targets === | |||
First, check whether ALSA knows about your sound card using the <code>aplay</code> utility from {{pkg|alsa-utils}} package: {{Cmd|aplay -l}} | |||
If sound devices are found, the issue is with your pipewire configuration. Consider double-checking the instructions above. Otherwise, your sound card may not be supported in the version of the Linux Kernel you're running. You should search online for fixes relating to your current kernel version and the codec of your sound card. You can find each of these with: | |||
{{Cmd|uname -r | |||
cat /proc/asound/card0/codec* | grep Codec}} | |||
Modern devices might require {{Pkg|sof-firmware}}, which is the case if you get <code>sof firmware file is missing</code> errors in dmesg. | |||
=== Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY === | |||
This means D-Bus session bus is not started and GUI is not active (i.e. you are in a tty). Use <code>dbus-run-session</code> as outlined [[#Running|above]]. Alternatively, [[#D-Bus|disable D-Bus support]]. | |||
=== Connection failure: Connection refused === | |||
When using [[Wayland]], ensure that [[XDG_RUNTIME_DIR]] is configured correctly. If this is not set, pipewire will create a directory in your home folder instead, called {{Path|~/pulse}}, and on attempting to run Pavucontrol or pactl, you will get the following error: | |||
<pre> | <pre> | ||
$ pactl list | |||
Connection failure: Connection refused | |||
pa_context_connect() failed: Connection refused | |||
</pre> | </pre> | ||
=== Bluetooth connect failed: br-connection-profile-unavailable === | |||
Ensure that [[#WirePlumber|Session Manager]] is running. | |||
=== Play/Pause buttons not working on bluetooth headphones === | |||
{{ | Check {{Path|/var/log/messages}}. If you see something like this: | ||
<pre> | |||
bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can't open input device: No such file or directory (2) | |||
bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5 | |||
</pre> | |||
Then bluez is trying to register the headphones buttons as an input devices, but <code>uinput</code> is not loaded. Try <code>modprobe uinput</code>. If this works, see [[Architecture#Module_Loading]] for instructions on how to make sure this module is loaded automatically on each startup. | |||
== See | == See also == | ||
* [[Bluetooth]] | |||
* [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository] | * [https://gitlab.freedesktop.org/pipewire/pipewire PipeWire source repository] | ||
* [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki] | * [https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/home PipeWire Wiki] | ||
* [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki] | * [https://wiki.archlinux.org/index.php/PipeWire PipeWire on the ArchWiki] | ||
* [https://wiki.gentoo.org/wiki/Pipewire PipeWire on the Gentoo Wiki] | * [https://wiki.gentoo.org/wiki/Pipewire PipeWire on the Gentoo Wiki] | ||
[[Category:Desktop]] | |||
[[Category:Multimedia]] | |||
[[Category:Sound]] |
Latest revision as of 11:09, 25 February 2025
PipeWire is a multimedia processing engine that aims to improve audio and video handling on Linux. Pipewire can act as a replacement for both PulseAudio and ALSA servers.
Prerequisites
PipeWire requires a running D-Bus system and/or session bus for most of its functionality. If you start session-wide dbus instance, make sure to start PipeWire in that same session.
PipeWire needs proper permissions to access devices. If elogind is used, no further configuration is required. Otherwise, the user should be in audio
(to access audio devices) and video
(to access webcam devices) groups. Make sure to re-login for these changes to take effect:
# addgroup <user> audio # addgroup <user> video

video
group will also grant unrestricted access to video devices, which is often a security issue. See issue #15409 for further details.
Installation
The following packages i.e pipewire and wireplumber a session manager are the minimum required packages for getting pipewire to work.
# apk add pipewire wireplumber
Pulseaudio interface
The package pipewire-pulse allows pulseaudio applications to use PipeWire as audio server in the backend.
# apk add pipewire-pulse
JACK compatibility
Since Pipewire replaces JACK, Install pipewire-jack package, so it provides ABI-compatible libraries for JACK applications.
# apk add pipewire-jack
ALSA support
Install pipewire-alsa package to provide support for Alsa applications.
# apk add pipewire-alsa
GUI tools
pavucontrol or pavucontrol-qt package provides a simple GUI app for controlling sound, outputs, etc. To use pavucontrol
tool install pipewire-pulse as the tool still needs Pulseaudio Interface. The XFCE Audio mixer can also be used to help control volume by installing the package xfce4-mixer which is currently in available in testing repository.
qpwgraph' is a graph manager dedicated to PipeWire with Qt GUI Interface.
Configuration
PipeWire and WirePlumber store their default configuration in /usr/share/pipewire and /usr/share/wireplumber respectively. If you want to edit the configuration, you need to move it to /etc:
# cp -a /usr/share/pipewire /etc # cp -a /usr/share/wireplumber /etc
pipewire-launcher
Start the PipeWire media server using the pipewire-launcher
script provided by Alpine Linux. You'll probably get quite a few errors but just ignore them for now.
$ /usr/libexec/pipewire-launcher
If .xinitrc is used, add /usr/libexec/pipewire-launcher to your ~/.xinitrc.
If you do not use GUI by default, add the following stanza to your shell configuration file:
export $(dbus-launch) /usr/libexec/pipewire-launcher
superd
to manage pipewire
and its related services.Screen sharing on Wayland
You will need the right xdg-desktop-portal backend for your desktop environment. Screen sharing is known to work on:
- GNOME with
xdg-desktop-portal-gtk
- KDE Plasma with
xdg-desktop-portal-kde
and Firefox - Sway with
xdg-desktop-portal-wlr
and Firefox, see Sway for details
Bluetooth audio
- Enable PulseAudio support as described above
- Install bluetooth service packages:
bluez bluez-openrc pipewire-spa-bluez
- Optional: install GUI manager for bluetooth
blueman
- Enable and start bluetooth service:
rc-update add bluetooth; rc-service bluetooth start
- Restart PipeWire
- Use commandline program
bluetoothctl
or GUI programblueman-manager
to scan and pair bluetooth audio devices. - Use pavucontrol to adjust volume and manually select high definition bluetooth codecs.
Video
Video should work out-of-the-box with v4l2 devices (e.g. a lot of webcams) and GStreamer applications.
Realtime scheduling
For realtime scheduling, it is recommended to use rtkit. Add your user to the rtkit
group.
Alternatively, ensure your user has the right ulimit permissions. Since pipewire 0.3.66, you can add yourself to the pipewire
group. You generally need (e.g. in /etc/security/limits.conf):
@pipewire - memlock 4194304 @pipewire - nice -19 @pipewire - rtprio 95
This allows a member of the pipewire group to have the right permissions for PipeWire to use realtime scheduling without rtkit. This same snippet comes with pipewire since 0.3.66, so if you have a PAM login session and add yourself to the pipewire group, you don't have to do anything else. Note that the above /etc/security/limits.conf will only work if your session is using PAM.
Disable D-Bus support

For certain configurations (e.g. only audio playback and recording) D-Bus setup is not necessary and it can be disabled as follows.
Edit the following configuration parameters:
Contents of /etc/pipewire/pipewire.conf
Contents of /etc/wireplumber/wireplumber.conf
Contents of /etc/wireplumber/bluetooth.lua.d/50-bluez-config.lua
Contents of /etc/wireplumber/main.lua.d/50-alsa-config.lua
Contents of /etc/wireplumber/main.lua.d/50-default-access-config.lua
Testing
Use the wpctl
utility from WirePlumber to test the working of pipewire:
$ wpctl status
pw-cat playback
Test sound is working using an audio file in a format supported by libsndfile
🔓 (e.g. flac, opus, ogg, wav). Use pw-cat
utility from pipewire-tools:
$ pw-cat -p test.flac $ pw-play /usr/share/sounds/alsa/Front_Center.wav
pw-cat recording
If you have a microphone test audio recording 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
PulseAudio
Test PulseAudio clients using a media player, as most use PulseAudio.
JACK
Use jack_simple_client
from jack-simple-clients:
$ jack_simple_client
You should hear a sustained beep.
Troubleshooting
`wpctl status` shows no targets
First, check whether ALSA knows about your sound card using the aplay
utility from alsa-utils package:
aplay -l
If sound devices are found, the issue is with your pipewire configuration. Consider double-checking the instructions above. Otherwise, your sound card may not be supported in the version of the Linux Kernel you're running. You should search online for fixes relating to your current kernel version and the codec of your sound card. You can find each of these with:
uname -r cat /proc/asound/card0/codec*
Modern devices might require sof-firmware, which is the case if you get sof firmware file is missing
errors in dmesg.
Error acquiring bus address: Cannot autolaunch D-Bus without X11 $DISPLAY
This means D-Bus session bus is not started and GUI is not active (i.e. you are in a tty). Use dbus-run-session
as outlined above. Alternatively, disable D-Bus support.
Connection failure: Connection refused
When using Wayland, ensure that XDG_RUNTIME_DIR is configured correctly. If this is not set, pipewire will create a directory in your home folder instead, called ~/pulse, and on attempting to run Pavucontrol or pactl, you will get the following error:
$ pactl list Connection failure: Connection refused pa_context_connect() failed: Connection refused
Ensure that Session Manager is running.
Play/Pause buttons not working on bluetooth headphones
Check /var/log/messages. If you see something like this:
bluetoothd[3463]: profiles/audio/avctp.c:uinput_create() Can't open input device: No such file or directory (2) bluetoothd[3463]: profiles/audio/avctp.c:init_uinput() AVRCP: failed to init uinput for WH-1000XM5
Then bluez is trying to register the headphones buttons as an input devices, but uinput
is not loaded. Try modprobe uinput
. If this works, see Architecture#Module_Loading for instructions on how to make sure this module is loaded automatically on each startup.