MPG321 与 sudo 一起使用时不起作用

MPG321 与 sudo 一起使用时不起作用

我在 Ubuntu Server 上运行 Raspberry Pi 4,但遇到了一个问题,mpg321由于某种原因,它在运行时无法正常工作sudo。例如,当我运行:

mpg321 /path/sound.mp3

这工作正常,我可以听到通过 3.5mm jck 连接的扬声器发出的声音,并得到以下输出:

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

Directory: /path
Playing MPEG stream from sound.mp3 ...
MPEG 1.0 layer III, 256 kbit/s, 44100 Hz joint-stereo

[0:03] Decoding of alert.mp3 finished.

但是当我使用 sudo 运行它时:

sudo mpg321 /path/sound.mp3

它不起作用,这就是我得到的结果:

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!

Directory: /path
Playing MPEG stream from sound.mp3 ...
MPEG 1.0 layer III, 256 kbit/s, 44100 Hz joint-stereo
Error opening unknown libao pulse driver. (Is device in use?)

我不明白这种行为。

只是为了清楚起见,我尝试运行此命令的唯一原因sudo是因为我有一个作为 systemctl 服务和 docker 容器运行的命名管道,我试图从我的容器向主机执行命令并使用命名管道,它确实有效,除了mpg321它给了我上面相同的错误输出,虽然我没有使用sudo,但我注意到在我的主机上当我用 sudo 运行它时我得到了相同的输出,所以我认为它们可能是相关的。

相关内容