教你在Linux_cetos6.2,64位系統的命令行模式下盡情聽MP3歌曲

   首先,聲明下這純屬自己玩的小玩意,因爲很少人會使用Linux的64位系統做爲自己的日常用系統,而且還是命令行模式,這是其一。其二、如果是服務器,更不可能裝聽歌軟件讓你抱個服務器聽歌。所以只能當學習研究。

   廢話少說,直接進入正題,

   需要的安裝包及下載地址:

1、mplayer源代碼包(MPlayer-1.0rc4.tar.bz2)

   下載:http://www.mplayerhq.hu/MPlayer/releases/

   wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc4.tar.gz

2、解碼器安裝包(all-20110131.tar.bz2)

   下載:http://www.mplayerhq.hu/MPlayer/releases/codecs/

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2

[root@localhost src]# tar -jxf all-20110131.tar.bz2
[root@localhost src]# mkdir /usr/local/lib/codecs/
[root@localhost src]# cp -fr all-20110131/* /usr/local/lib/codecs/

   在安裝mplayer前先把解碼器拷貝過去,然後進去mplayer目錄中直接安裝。 安裝時要注意--prefix=/usr這個參數如果不指定,會裝到/bin下。  

[root@localhost src]# cp -fr all-20110131/* /usr/local/lib/codecs/
[root@localhost MPlayer-1.0rc4]# ./configure --prefix=/usr --codecsdir=/usr/local/lib/codecs --enable-largefiles --enable-menu --language=zh_CN,en --charset=utf8 --confdir=/usr/local/mplayer --charset=noconv
[root@localhost MPlayer-1.0rc4]# make
[root@localhost MPlayer-1.0rc4]# make install

安裝後,找首歌曲做下實驗,下載一首《waiting_for_you.mp3》

[root@localhost music]# ls
waiting_for_you.mp3
[root@localhost music]# mplayer -ac mp3 waiting_for_you.mp3
創建配置文件:/root/.mplayer/config
MPlayer 1.0rc4-4.4.6 (C) 2000-2010 MPlayer Team

正在播放 waiting_for_you.mp3。
檢測到文件格式 Audio only。
==========================================================================
強制使用音頻編解碼器:mp3
打開音頻解碼器: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
已選音頻編解碼器: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO OSS] audio_setup:無法打開音頻設備 /dev/dsp:No such file or directory
DVB card number must be between 1 and 4
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
視頻:沒有視頻流
開始播放...
A: 3.4 (03.3) of 324.0 (05:24.0) 0.7%

    這樣,就可以在命令行模式下聽歌了。
mplayer -ac mp3 waiting_for_you.mp3這條命令中,-ac後面爲解碼器,可以用 mplayer -ac help查看解碼器。
播放錯誤處理:
錯誤代碼:

[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...
[AO OSS] 無法設定音頻設備 /dev/dsp 至 s16le 的輸出,嘗試使用 s16le...

  出現這個錯誤要在root用戶模式下執行下面的命令

[root@localhost ~]# modprobe snd_pcm_oss





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章