树莓派安装mplayer后播放歌曲能看到进度在跳动,但是无声音。输出信息如下:

1
pi@raspberrypi:~ $ mplayer 01-几个你.mp3

MPlayer2 2.0-728-g2c378c7-4+b1 (C) 2000-2012 MPlayer Team
Cannot open file ‘/home/leez/.mplayer/input.conf’: No such file or directory
Failed to open /home/leez/.mplayer/input.conf.
Cannot open file ‘/etc/mplayer/input.conf’: No such file or directory
Failed to open /etc/mplayer/input.conf.

Playing 01-几个你.mp3.
Detected file format: MP2/3 (MPEG audio layer 2/3) (libavformat)
[mp3 @ 0x75bee5b8]max_analyze_duration 5000000 reached
[lavf] stream 0: audio (mp3), -aid 0
Clip info:
encoder: Lavf57.25.100
Load subtitles in .
Selected audio codec: MPEG 1.0/2.0/2.5 layers I, II, III [mpg123]
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
AO: [pulse] Init failed: Connection refused
[AO_ALSA] alsa-lib: confmisc.c:768:(parse_card) cannot find card ‘0’
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:392:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:1251:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
[AO_ALSA] alsa-lib: conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
[AO_ALSA] Playback open error: No such file or directory
[AO OSS] audio_setup: Can’t open audio device /dev/dsp: No such file or directory
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
[JACK] cannot open server
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format s16le
[AO_ALSA] alsa-lib: confmisc.c:768:(parse_card) cannot find card ‘0’
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:392:(snd_func_concat) error evaluating strings
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
[AO_ALSA] alsa-lib: confmisc.c:1251:(snd_func_refer) error evaluating name
[AO_ALSA] alsa-lib: conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
[AO_ALSA] alsa-lib: conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
[AO_ALSA] alsa-lib: pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
[AO SDL] Unable to open audio: No available audio device
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback…
A: 22.6 (22.5) of 316.6 (05:16.6) 2.9%

Exiting… (End of file)

分析输出,可见是无法打开音频设备文件,推测可能是没有权限打开。
加上 sudo 重新执行命令即可正常播放音乐。

1
pi@raspberrypi:~ $ sudo mplayer 01-几个你.mp3