Chinaunix首页 | 论坛 | 博客
  • 博客访问: 829580
  • 博文数量: 125
  • 博客积分: 4066
  • 博客等级: 上校
  • 技术积分: 1401
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-03 18:58
文章分类

全部博文(125)

文章存档

2014年(1)

2013年(1)

2012年(2)

2011年(29)

2010年(92)

我的朋友

分类: LINUX

2010-06-01 11:26:32

ubuntu mplayer播放AMR格式音频文件

下面的方法比较笨,听说可以通过先安装mplayer,后下载codec放在/usr/local/bin/codec/下面就可以,具体的我没有尝试,不明。


mplayer默认安装时,是不支持amr格式的,可以做些修改:

办法是下载 amrnb 和 amrwb 的解码,然后重新编译 mplayer。

步骤:

第一步可以不用做,只是考虑到以后要用到media相关的好备用。

1:将 medibuntu 加入到源(/etc/apt/source.list.d/ 下面为不同的源建立不同的文件)
代码:

sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list
请注意根据自己的发行版本下载不同的文件。上述例子是针对 Jaunty (9.04)。
2.更新并加入 medibuntu 的 key
代码:

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update


2. 在 官方网站上下载mplyer源码

3.下载AMRNB和AMRWB解码器

1) amr narrow band:

Code:
 
$ cd $HOME/Desktop
$ wget
$ tar xjvf amrnb-7.0.0.0.tar.bz2
$ cd amrnb-7.0.0.0
$ wget
$ ./configure --enable-shared --disable-static
$ make
$ sudo make install
2) amr wide band:

Code:
$ cd $HOME/Desktop
$ wget
$ tar xjvf amrwb-7.0.0.2.tar.bz2
$ cd amrwb-7.0.0.2
$ wget
$ ./configure --enable-shared --disable-static
$ make
$ sudo make install

4. 编译mplayer

  ./configure --prefix=/usr 

  make

  sudo make install

5. Ok,可以用了

zhaixishan@zhaixishan-desktop:~$ mplayer ~/Desktop/shared/call_record_HHMXXu.amr
MPlayer SVN-r31291-4.4.1 (C) 2000-2010 MPlayer Team

Playing /home/zhaixishan/Desktop/shared/call_record_HHMXXu.amr.
libavformat file format detected.
[amr @ 0x9c759b0]max_analyze_duration reached
[amr @ 0x9c759b0]Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (amrnb), -aid 0
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 8000 Hz, 1 ch, s16le, 0.0 kbit/0.00% (ratio: 0->16000)
Selected audio codec: [libopencoreamrnb] afm: ffmpeg (AMR Narrowband)
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: Device or resource busy
AO: [alsa] 8000Hz 1ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   2.0 (01.9) of 0.0 (unknown)  0.2%     


6. 如果执行过程中,发现有找不到的错误

bash: /usr/bin/mplayer: No such file or directory

我也不想烦了,直接用了个软连接, ln -s /usr/local/bin/mplayer /usr/bin/mplayer

搞定,收工。。。。

7.至于皮肤什么的,大家可以看看下面的办法

官方网站的办法:

______________________
STEP0: Getting MPlayer
~~~~~~~~~~~~~~~~~~~~~~

Official releases and Subversion snapshots, as well as binary codec packages
and a number of different skins for the GUI are available from the download
section of our homepage at

/dload.html

MPlayer has builtin support for the most common audio and video formats. For a
few formats no native decoder exists and external binary codecs are required
to handle them. Examples are newer RealVideo variants and a variety of rare
formats. However, binary codecs are NOT required in this day and age, they are
strictly optional.

Please note that binary codecs only work on the processor architecture they
were compiled for. Choose the correct package for your processor. No other
package is necessary.

The GUI needs at least one skin and codec packages add support for some more
video and audio formats. MPlayer does not come with any of these by default,
you have to download and install them separately.

You can also get MPlayer via Subversion. Issue the following commands to get
the latest sources:

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

A directory named 'mplayer' will be created. It will include all necessary
FFmpeg libraries, you don't need to get them separately as was the case in
the past. You can later update your sources by saying

svn update

from within that directory.


_______________________________
STEP1: Installing Binary Codecs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Unpack the codecs archives and put the contents in a directory where MPlayer
will find them. The default directory is /usr/local/lib/codecs/ (it used to be
/usr/local/lib/win32 in the past, this also works) but you can change that to
something else by passing the '--codecsdir' option to './configure'.


__________________________
STEP2: Configuring MPlayer
~~~~~~~~~~~~~~~~~~~~~~~~~~

MPlayer can be adapted to all kinds of needs and hardware environments. Run

./configure

to configure MPlayer with the default options. GUI support has to be enabled
separately, run

./configure --enable-gui

if you want to use the GUI.

If something does not work as expected, try

./configure --help

to see the available options and select what you need.

The configure script prints a summary of enabled and disabled options. If you
have something installed that configure fails to detect, check the file
configure.log for errors and reasons for the failure. Repeat this step until
you are satisfied with the enabled feature set.


________________________
STEP3: Compiling MPlayer
~~~~~~~~~~~~~~~~~~~~~~~~

Now you can start the compilation by typing

make

You can install MPlayer with

make install

provided that you have write permission in the installation directory.

If all went well, you can run MPlayer by typing 'mplayer'. A help screen with a
summary of the most common options and keyboard shortcuts should be displayed.

If you get 'unable to load shared library' or similar errors, run
'ldd ./mplayer' to check which libraries fail and go back to STEP 3 to fix it.
Sometimes running 'ldconfig' is enough to fix the problem.

NOTE: If you run Debian you can configure, compile and build a proper Debian
.deb package with only one command:

fakeroot debian/rules binary

If you want to pass custom options to configure, you can set up the
DEB_BUILD_OPTIONS environment variable. For instance, if you want GUI
and OSD menu support you would use:

DEB_BUILD_OPTIONS="--enable-gui --enable-menu" fakeroot debian/rules binary

You can also pass some variables to the Makefile. For example, if you want
to compile with gcc 3.4 even if it's not the default compiler:

CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-gui" fakeroot debian/rules binary

To clean up the source tree run the following command:

fakeroot debian/rules clean

______________________________________
STEP4: Choose an onscreen display font
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can use any TrueType font installed on your system. Just pass '-font
/path/to/font.ttf' on the command line or add 'font=/path/to/font.ttf' to
your configuration file. The manual page has more details. Alternatively
you can create a symbolic link from either ~/.mplayer/subfont.ttf or
/usr/local/share/mplayer/subfont.ttf to your TrueType font.


____________________________
STEP5: Installing a GUI skin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Unpack the archive and put the contents in /usr/local/share/mplayer/skins/ or
~/.mplayer/skins/. MPlayer will use the skin in the subdirectory named default
of /usr/local/share/mplayer/skins/ or ~/.mplayer/skins/ unless told otherwise
via the '-skin' switch. You should therefore rename your skin subdirectory or
make a suitable symbolic link.


__________________
STEP6: Let's play!
~~~~~~~~~~~~~~~~~~

That's it for the moment. To start playing movies, open a command line and try

mplayer

or for the GUI

gmplayer

gmplayer is a symbolic link to mplayer created by 'make install'.
Without , gmplayer will start with the GUI filepicker.

To play a VCD track or a DVD title, try:

mplayer vcd://2 -cdrom-device /dev/hdc
mplayer dvd://1 -alang en -slang hu -dvd-device /dev/hdd

See 'mplayer -help' and 'man mplayer' for further options.

'mplayer -vo help' will show you the available video output drivers. Experiment
with the '-vo' switch to see which one gives you the best performance.
If you get jerky playback or no sound, experiment with the '-ao' switch (see
'-ao help') to choose between different audio drivers. Note that jerky playback
is caused by buggy audio drivers or a slow processor and video card. With a
good audio and video driver combination, one can play DVDs and 720x576 MPEG-4
files smoothly on a Celeron 366. Slower systems may need the '-framedrop'
option.

Questions you may have are probably answered in the rest of the documentation.
The places to start reading are the man page, DOCS/HTML/en/index.html and
DOCS/HTML/en/faq.html. If you find a bug, please report it, but first read
DOCS/HTML/en/bugreports.html.
阅读(6268) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~