如何在 Ubuntu 21.04 上用 pipewire 替换pulseaudio?

use*_*950 13 sound pulseaudio pipewire

由于 Ubuntu 21.04 默认包含用于视频流和屏幕共享的管道,我想知道是否可以用管道完全替换脉冲音频。

use*_*950 19

是的,这是可能的,而且相当简单,只需按照Debian 文档中描述的步骤操作即可

首先安装 pipewire-audio-client-libraries 包。

sudo apt install pipewire-audio-client-libraries
Run Code Online (Sandbox Code Playgroud)

创建这个空文件:

touch /etc/pipewire/media-session.d/with-pulseaudio
Run Code Online (Sandbox Code Playgroud)

通过复制示例文件创建 pipewire-pulse 服务:

cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /etc/systemd/user/
Run Code Online (Sandbox Code Playgroud)

以您的普通用户(而不是 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
Run Code Online (Sandbox Code Playgroud)

您可以通过作为您的普通用户运行以下命令来检查正在使用的服务器:

pactl info | grep '^Server Name'
Run Code Online (Sandbox Code Playgroud)

如果它使用 PipeWire,服务器名称将是“PulseAudio (On​​ PipeWire 0.3.19)”

为了使它工作,我必须通过运行来“屏蔽”PulseAudio 服务:

systemctl --user mask pulseaudio
Run Code Online (Sandbox Code Playgroud)

然后重新启动 PipeWire 服务:

systemctl --user restart pipewire pipewire-pulse
Run Code Online (Sandbox Code Playgroud)

这将阻止 PulseAudio 服务被彻底激活。如果您希望恢复以前的功能,则需要使用“取消屏蔽”操作再次运行相同的命令。


Kar*_*ski 8

在 Ubuntu 21.10 上

首先安装缺少的 PipeWire 软件包:

sudo apt install pipewire-pulse pipewire-audio-client-libraries

如果您希望蓝牙音频正常工作,您还需要安装:

sudo apt install libspa-0.2-bluetooth

之后,随意禁用pulsaudio并启用PipeWire运行这些命令(无需root):

// 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
Run Code Online (Sandbox Code Playgroud)

就是这样!您可以通过运行来确认一切正常:

pactl info | grep '^Server Name'

输出应该与此类似:

Server Name: PulseAudio (on PipeWire 0.3.32)

重新启动 Pipewire 服务

systemctl --user restart pipewire pipewire-pulse


Sou*_*Das 5

Arch 用户在这里。但喜欢 PipeWire。下所有debian/Ubuntu{18..21}.{04,10}版本的PW 太旧了。这就是为什么我要维护一个PPA,它将提供 PipeWire 的最新版本(发布周期为 15-16 天)。您可以在github上跟踪 此 PPA 的最新更改。

在 arch linux 上,这个过程是通过包的 *.install 文件下的 {pre,post}_{install,upgrade,remove} 函数获得的。

而在 Ubuntu/Debian 下会通过一些简单的{pre,post}{inst,rm}脚本来实现。我肯定会在下一个版本中更新这些。这已经完成了。

编辑 1 -
有关详细的安装说明,请关注 github wiki

使用 PipeWire 我也在打包blueman-git(blueman 的 git 版本)。它有一些与 PipeWire 一起使用的非常需要的功能。别担心,它也不会破坏任何东西,只会将您的生产力提高到更高的水平。

编辑 2 -
Launchpad PPA 将在debian/ubuntu基于所有发行版的发行版下工作。别担心!安装它,测试它并向上游提交错误,以帮助它的开发人员使 PipeWire 变得更好。

编辑 3 -
现在PipeWire 0.3.27和病房也将支持下debian/ubuntu 18.04

  • 好吧,别担心,我是按照你的 github 上的说明(而不是上面发布的内容)操作后才开始工作的。 (2认同)