通过命令行配置 HDMI 音频

Dae*_*yth 8 10.04 sound pulseaudio hdmi

我正在寻找一种使用pulseaudio通过命令行配置HDMI音频输出的方法。我能够通过使用 pavucontrol 并在配置选项卡中更改它来运行它,但我需要一种方法来自动化该过程。到目前为止,我根本找不到任何文档。该系统是一个清晰的安装。

编辑:根据我的发现,我可以pacmd set-card-profile用来做到这一点。但是,每当我尝试时,都会收到如下错误(使用 中定义的默认配置文件/usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf

# pacmd set-card-profile 0 hdmi-stereo
Welcome to PulseAudio! Use "help" for usage information.
>>> Failed to set card profile to 'hdmi-stereo'.

# pacmd set-card-profile 0 analog-stereo
Welcome to PulseAudio! Use "help" for usage information.
>>> Failed to set card profile to 'analog-stereo'.
Run Code Online (Sandbox Code Playgroud)

当 pavucontrol 可以更改它们时,为什么我不能从命令行更改它们?

Dae*_*yth 15

我用错了工具。正确的做法是pactl set-card-profile 0 output:hdmi-audio。您可以通过运行获取可用配置文件名称的列表pacmd list-cards