Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1827975
  • 博文数量: 323
  • 博客积分: 5970
  • 博客等级: 大校
  • 技术积分: 2764
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-03 23:13
文章分类

全部博文(323)

文章存档

2018年(2)

2017年(11)

2016年(10)

2015年(27)

2014年(2)

2013年(30)

2012年(197)

2011年(44)

分类: LINUX

2011-06-11 02:00:22

Linux MPlayer 安装


接触linux刚不久,打算装个播放器玩玩,结果发现,里面装个播放器好累,一不小心就会出现一些让你摸不到头脑的错误。此文是本人安装mplayer所遇到的问题和一些解决方案,并不能保证对所有的Linux系统都管用,内容仅供参考,有些地方表达的可能不够准确,还望谅解。


网上看了好多有关linuxmplayer的安装的文档,但是你会发现,他们的安装几乎都不会出错(这点我很纳闷),而且好多的文档都只是一份的副本,或许作者根本就没有实际装过,或许都不知道是怎么回事,然后就给贴上去了。有什么作用呢?


好,下面正题


系统环境:

RHEL6.0(英文版本)(系统安装了基本系统,桌面,软件开发的包且LanguagesChinese support,这些包有助于你安装mplayer,如果没安装这些包,在安装mplayer时可能会遇到好多的问题,而且会有好多的包依赖关系,所以建议装系统时选择这些包进行安装,不然出现错误,不要说没提醒你哈)

注意:个人觉得,这个系统环境挺重要的,因为,在之前的那次安装过程中我的环境只是一个RHEL6.0的基本系统,结果出现了一大堆的依赖关系等着你去解决。


准备工作:

MPlayer安装需要的包或文件:

windows-all-20071007.zip--------提供解码功能

all-20071007.tar.bz2---------------提供解码功能

MPlayer-1.0rc2.tar.bz2-------------mplayer主程序包

Ater-1.2.tar.bz2----------------------皮肤包

以上文件都可以从mplayer官网下载得到

(目前最新版本是MPlayer-1.0rc4.tar.bz2


注:如果mplayer版本为MPlayer-1.0rc4,则在configure内,没有win32codecsdir参数,网上类似的帖子有的说是同MPlayer-1.0rc2的接口不同,但没有找到具体原因。


建立目录(先不管,后面有用的)

mkdir /usr/lib/codecs

mkdir /usr/lib/wincodecs

将下载的文件放入一个目录中,比如就放在 /home/vookang/Temp/ 下(当然你可以放其他任何位置都行,此处只是举例说明)


进入Temp目录

cd /home/vookang/Temp


解压下载的文件

unzip windows-all-20071007.zip

tar xvjf all-20071007.tar.bz2

tar xvjf MPlayer-1.0rc2.tar.bz2

tar xvjf Ater-1.2.tar.bz2

接着

mv windows-all-20071007 /usr/lib/wincodecs/

mv all-20071007 /usr/lib/codecs/

进入MPlayer-1.0rc2

cd MPlayer-1.0rc2


修改源文件的内容(MPlayer-1.0rc2/libvo/video_out.c文件)大概位置在101的地方有这么几句:

99 extern vo_functions_t video_out_dxr2;

100 #endif

101 extern vo_functions_t video_out_dxr3;

102 #ifdef HAVE_IVTV

103 extern vo_functions_t video_out_ivtv;

104 #endif

然后修改为:

99 extern vo_functions_t video_out_dxr2;

100 #endif

101 #ifdef

102 extern vo_functions_t video_out_dxr3;

103 #endif

104 #ifdef HAVE_IVTV

105 extern vo_functions_t video_out_ivtv;

106 #endif

提示:如果不修改此处,在后面make的时候会有个错误(libvo/libvo.a(video_out.o):(.data+0x44): undefined reference to ‘video_out_ivtv’

好,到此,准备工作做完了。

注:我在安装的时候,没有加这一段,也能make成功,修改后反而报错了。


安装:

首先要configure下:(确保此时应当在MPlayer-1.0rc2目录下)

./configure –prefix=/usr/local/mplayer –enable-gui –disable-ivtv –language=en_US –codecsdir=/usr/lib/codecs –win32codecsdir=/usr/lib/wincodecs

这步下来,之后就可以说是一马平川了。

等待./configure完后,执行:

make


make会需要相对较长的时间,这里你可以做其他的事情。经过上面的设置,make没有出错。等make完后,接着执行:

make install

make install用来安装你的程序,执行make install结束后就可以使用mplayer程序播放视频了。安装的默认位置在 /usr/local/mplayer/bin/gmplayer bin下的gmplayermplayer都是同样的功能)。例如:

/usr/local/mplayer/bin/gmplayer xxxx.avi

此时,可能会出现一个问题,提示说没有默认的skin。(为什么是可能会出现,因为我第一次装完没出现这个错误,第二次装完就冒出这个错误了)

好,现在就装个默认皮肤。其实只需要将你解压的皮肤文件夹放到某个目录下就可以了。对于本例:

mv Ater /usr/local/mplayer/share/mplayer/skins/

然后进入skins,命令为:

cd /usr/local/mplayer/share/mplayer/shins/

之后建立一个符号链接:

ln –s Ater default

因为mplayer会去查找default skin,所以这里需要重命名为default。但是,对于我的mplayer来说,似乎这个皮肤根本没有起到任何作用,呵呵,也不知道为什么,但是不影响视频效果。

好,这下完了,欣赏你的视频吧。


mplayer功能强大,但是之后你会发现你的mplayer在播放rmvb的时候,只有声音,而没有画面,这又是什么问题呢,这个问题其实已经找到了,就是在你播放rmvb声音的时候,你可以看到,终端里会出现好多的error,在里面你可以找到类似 /xxxx/xxx/xxxx/xxx 一串字符串,说在这个目录下找不到什么什么东西,主要还是些库什么的。此时你这需要用个cp就可以了

cp /usr/lib/wincodecs/* /usr/local/lib/win32


如果没有win32这个文件夹,就用mkdir创建一个。好了,这下你就可以用你的mplayer播放rmvb的视频文

件了。

=================

通过svn下载 svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

然后进入 mplayer 目录 执行svn update

 

确保你希望已经安装了有关声卡显卡的包 尽量全面些 免得出现有声音没画面 有画面没声音的情况

执行

 

[root@localhost mplayer]# ./configure --enable-gui --language=en_US --enable-freetype --charset=utf8 --enable-menu --codecsdir=/usr/lib64/codecs/
Current branch master is up to date.
Checking for cc version ... 4.4.5 
Checking for working compiler ... yes
Detected operating system: Linux
Detected host architecture: x86_64
Checking for cross compilation ... no 
Checking for host cc ... cc 
Checking for CPU vendor ... GenuineIntel (6:23:10) 
Checking for CPU type ...  Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz 
Checking for kernel support of mmx ... yes 
Checking for kernel support of mmxext ... yes 
Checking for kernel support of sse ... yes 
Checking for kernel support of sse2 ... yes 
Checking for kernel support of ssse3 ... yes 
Checking for kernel support of cmov ... yes 
Checking for mtrr support ... yes 
Checking for GCC & CPU optimization abilities ... native 
Checking for byte order ... little-endian 
Checking for extern symbol prefix ...  
Checking for assembler support of -pipe option ... yes 
Checking for PIC ... no 
Checking for .align is a power of two ... no 
Checking for ebx availability ... yes 
Checking for yasm ... yasm 
Checking for bswap ... yes 
Checking for xmm clobbers ... yes 
Checking for langinfo ... yes 
Checking for language ... messages: en - man pages: en - documentation: en 
Checking for enable sighandler ... yes 
Checking for runtime cpudetection ... no 
Checking for restrict keyword ... restrict 
Checking for __builtin_expect ... yes 
Checking for kstat ... no 
Checking for exp2 ... yes 
Checking for exp2f ... yes 
Checking for llrint ... yes 
Checking for llrintf ... yes 
Checking for log2 ... yes 
Checking for log2f ... yes 
Checking for lrint ... yes 
Checking for lrintf ... yes 
Checking for round ... yes 
Checking for roundf ... yes 
Checking for trunc ... yes 
Checking for truncf ... yes 
Checking for mkstemp ... yes 
Checking for nanosleep ... yes 
Checking for socklib ... yes 
Checking for netdb.h, struct addrinfo ... yes 
Checking for netdb.h, getaddrinfo() ... yes 
Checking for sockaddr_storage ... yes 
Checking for struct ipv6_mreq ... yes 
Checking for struct sockaddr_in6 ... yes 
Checking for struct sockaddr sa_len ... no 
Checking for arpa/inet.h ... yes 
Checking for inet_pton() ... yes 
Checking for inet_aton() ... yes 
Checking for socklen_t ... yes 
Checking for closesocket() ... no 
Checking for networking ... yes 
Checking for inet6 ... yes 
Checking for gethostbyname2 ... yes 
Checking for sys/poll.h ... yes 
Checking for inttypes.h (required) ... yes 
Checking for int_fastXY_t in inttypes.h ... yes 
Checking for malloc.h ... yes 
Checking for memalign() ... yes 
Checking for posix_memalign() ... yes 
Checking for alloca.h ... yes 
Checking for fastmemcpy ... yes 
Checking for hard-coded tables ... no 
Checking for mman.h ... yes 
Checking for dynamic loader ... yes 
Checking for dynamic a/v plugins support ... no 
Checking for pthread ... yes (using -lpthread)
Checking for w32threads ... no (using pthread instead)
Checking for rpath ... no 
Checking for iconv ... yes 
Checking for soundcard.h ... yes (sys/soundcard.h)
Checking for sys/dvdio.h ... no 
Checking for sys/cdio.h ... no 
Checking for linux/cdrom.h ... yes 
Checking for dvd.h ... no 
Checking for termcap ... yes (using -lncurses)
Checking for termios ... yes (using termios.h)
Checking for shm ... yes 
Checking for strsep() ... yes 
Checking for vsscanf() ... yes 
Checking for POSIX select() ... yes 
Checking for audio select() ... yes 
Checking for gettimeofday() ... yes 
Checking for glob() ... yes 
Checking for setenv() ... yes 
Checking for setmode() ... no 
Checking for sys/sysinfo.h ... yes 
Checking for Apple IR ... yes 
Checking for pkg-config ... yes 
Checking for Samba support (libsmbclient) ... no 
Checking for /dev/mga_vid ... no 
Checking for tdfxfb ... no 
Checking for s3fb ... no 
Checking for wii ... no 
Checking for tdfxvid ... no 
Checking for xvr100 ... no 
Checking for tga ... yes 
Checking for md5sum support ... yes 
Checking for yuv4mpeg support ... yes 
Checking for bl ... no 
Checking for DirectFB ... no 
Checking for X11 headers presence ... yes 
Checking for X11 ... yes 
Checking for Xss screensaver extensions ... no 
Checking for DPMS ... yes (using Xdpms 4)
Checking for Xv ... no 
Checking for XvMC ... no 
Checking for VDPAU ... no 
Checking for Xinerama ... yes 
Checking for Xxf86vm ... yes 
Checking for XF86keysym ... yes 
Checking for DGA ... no 
Checking for xmga ... no 
Checking for 3dfx ... no 
Checking for VIDIX ... yes 
Checking for VIDIX PCI device name database ... yes 
Checking for VIDIX dhahelper support ... no 
Checking for VIDIX svgalib_helper support ... no 
Checking for GGI ... no 
Checking for GGI extension: libggiwmh ... no 
Checking for AA ... no 
Checking for CACA ... no 
Checking for SVGAlib ... no 
Checking for FBDev ... yes 
Checking for DVB ... yes 
Checking for PNG support ... yes 
Checking for MNG support ... yes 
Checking for JPEG support ... yes 
Checking for OpenJPEG (JPEG 2000) support ... no 
Checking for PNM support ... yes 
Checking for GIF support ... no 
Checking for VESA support ... no 
Checking for SDL ... no 
Checking for OpenGL ... yes (backends: x11)
Checking for MatrixView ... yes 
Checking for DXR2 ... no 
Checking for DXR3/H+ ... no 
Checking for IVTV TV-Out (pre linux-2.6.24) ... no 
Checking for V4L2 MPEG Decoder ... yes 
Checking for OSS Audio ... yes 
Checking for aRts ... no 
Checking for EsounD ... no 
Checking for NAS ... no 
Checking for pulse ... yes 
Checking for JACK ... no 
Checking for OpenAL ... no 
Checking for ALSA audio ... yes (using alsa 1.0.x and alsa/asoundlib.h)
Checking for Sun audio ... no 
Checking for VCD support ... yes 
Checking for Blu-ray support ... no 
Checking for dvdread ... yes (internal)
Checking for internal libdvdcss ... yes 
Checking for cdparanoia ... no 
Checking for libcdio ... no 
Checking for bitmap font support ... yes 
Checking for freetype >= 2.0.9 ... yes 
Checking for fontconfig ... yes 
Checking for SSA/ASS support ... yes 
Checking for fribidi with charsets ... no 
Checking for ENCA ... no 
Checking for zlib ... yes 
Checking for bzlib ... yes 
Checking for RTC ... yes 
Checking for liblzo2 support ... no 
Checking for mad support ... no 
Checking for Twolame ... no 
Checking for Toolame ... no 
Checking for OggVorbis support ... yes (internal Tremor)
Checking for libspeex (version >= 1.1 required) ... no 
Checking for libgsm ... no 
Checking for OggTheora support ... no 
Checking for mp3lib support ... yes 
Checking for mpg123 support ... no 
Checking for liba52 support ... no 
Checking for libmpeg2 support ... yes (internal)
Checking for libdca support ... no 
Checking for libmpcdec (musepack, version >= 1.2.1 required) ... no 
Checking for FAAC support ... no (in FFmpeg: no)
Checking for FAAD2 support ... no 
Checking for LADSPA plugin support ... no 
Checking for libbs2b audio filter support ... no 
Checking for Win32 codecs ... no 
Checking for XAnim codecs ... yes (dynamic loader support needed)
Checking for RealPlayer codecs ... yes (dynamic loader support needed)
Checking for QuickTime codecs ... auto 
Checking for Nemesi Streaming Media libraries ... no 
Checking for LIVE555 Streaming Media libraries ... no 
Checking for RTMPDump Streaming Media library ... no 
Checking for FFmpeg ... yes 
Checking for libopencore_amr narrowband ... no 
Checking for libopencore_amr wideband ... no 
Checking for libdv-0.9.5+ ... no 
Checking for CrystalHD ... no 
Checking for Xvid ... no 
Checking for Xvid two pass plugin ... no 
Checking for x264 ... no (in FFmpeg: no)
Checking for libdirac ... no 
Checking for libschroedinger ... no 
Checking for libvpx ... no 
Checking for libnut ... no 
Checking for zr ... no 
Checking for libmp3lame ... no (in FFmpeg: no)
Checking for mencoder ... yes 
Checking for UnRAR executable ... yes 
Checking for TV interface ... yes 
Checking for DirectShow TV interface ... auto 
Checking for Video 4 Linux TV interface ... yes 
Checking for Video 4 Linux 2 TV interface ... yes 
Checking for Radio interface ... no 
Checking for Capture for Radio interface ... no 
Checking for Video 4 Linux 2 Radio interface ... auto 
Checking for Video 4 Linux Radio interface ... auto 
Checking for Video 4 Linux 2 MPEG PVR interface ... yes 
Checking for ftp ... yes 
Checking for vstream client ... no 
Checking for OSD menu ... yes 
Checking for Subtitles sorting ... yes 
Checking for XMMS inputplugin support ... no 
Checking for GUI ... yes
Checking for XShape extension ... yes 
Checking for GTK+ version ... 2.18.9 
Checking for glib version ... 2.22.5 
Checking for iconv program ... yes 
Checking for automatic gdb attach ... no 
Checking for compiler support for noexecstack ... yes 
Checking for linker support for --nxcompat --no-seh --dynamicbase ... no 
Checking for joystick ... no 
Checking for lirc ... no 
Checking for lircc ... no 
Checking for DVD support (libdvdnav) ... yes (internal)
Creating config.mak
Creating config.h

Config files successfully generated by ./configure --enable-gui --language=en_US --enable-freetype --charset=utf8 --enable-menu --codecsdir=/usr/lib64/codecs/ !

  Install prefix: /usr/local
  Data directory: /usr/local/share/mplayer
  Config direct.: /usr/local/etc/mplayer

  Byte order: little-endian
  Optimizing for: native

  Languages:
    Messages/GUI: en
    Manual pages: en
    Documentation: en

  Enabled optional drivers:
    Input: dvdnav(internal) ftp pvr tv-v4l2 tv-v4l tv libdvdcss(internal) dvdread(internal) vcd dvb networking 
    Codecs: ffmpeg(internal) real xanim libmpeg2(internal) mp3lib(internal) tremor(internal) 
    Audio output: alsa pulse oss v4l2 mpegpes(dvb) 
    Video output: v4l2 matrixview opengl pnm jpeg mng mpegpes(dvb) fbdev xvidix cvidix x11 xover yuv4mpeg md5sum tga 

  Disabled optional drivers:
    Input: vstream radio tv-dshow librtmp live555 nemesi cddb cdda bluray smb 
    Codecs: libvpx libschroedinger libdirac x264 xvid crystalhd libdv libopencore_amrwb libopencore_amrnb qtx win32 faad2 faac musepack libdca liba52 mpg123 libtheora libgsm speex toolame twolame libmad liblzo gif OpenJPEG 
    Audio output: sun openal jack nas esd arts ivtv dxr2 sdl 
    Video output: zr zr2 ivtv dxr3 dxr2 sdl vesa gif89a svga caca aa ggi winvidix 3dfx xmga dga vdpau xvmc xv directfb dfbmga bl xvr100 tdfx_vid wii s3fb tdfxfb mga 

'config.h' and 'config.mak' contain your configuration options.
Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
      compile *** DO NOT REPORT BUGS if you tweak these files ***

'make' will now compile MPlayer and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.

Please check MTRR settings at /proc/mtrr (see DOCS/HTML/en/video.html#mtrr)

NOTE: Win32 codec DLLs are not supported on your CPU (x86_64) or your
operating system (Linux). You may encounter a few files that cannot
be played due to missing open source video/audio codec support.

Check config.log if you wonder why an autodetection failed (make sure
development headers/packages are installed).

NOTE: The --enable-* parameters unconditionally force options on, completely
skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
If you used one of these options (except --enable-menu and similar ones that
turn on internal features) and experience a compilation or linking failure,
make sure you have passed the necessary compiler/linker flags to configure.

If you suspect a bug, please read DOCS/HTML/en/bugreports.html.

[root@localhost mplayer]# 

 

从标红部分 可以知道那些参数选项是成功的 虽然有提示win32的解码什么的 我也懒的弄 总之影响不打

然后make && makeinstall

最后说到皮肤的问题

皮肤所在的文件夹为 /usr/local/share/mplayer/skins/
在该目录下 新建一个default文件夹

把皮肤下载下来 然后解压 把解压后的文件夹中的所有部分 复制到default文件夹下 皮肤就搞定了

推荐的皮肤有3个

iTunes

iTunes-mini

Linea

这3个皮肤还不错 好看

其他的都不符合我的审美

嘿嘿


===============

在Red Hat Enterprise Linux 6下编译Mplayer过程很忐忑,特记录一下:

首先

# wget 
# tar -zxvf MPlayer-1.0rc4.tar.bz2
# ./configure
# make

出现错误:

libmpcodecs/vd_mpng.c: In function 'pngReadFN':
libmpcodecs/vd_mpng.c:77: error: dereferencing pointer to incomplete type
libmpcodecs/vd_mpng.c: In function 'decode':
libmpcodecs/vd_mpng.c:114: error: dereferencing pointer to incomplete type
libmpcodecs/vd_mpng.c:131: error: dereferencing pointer to incomplete type
make: *** [libmpcodecs/vd_mpng.o] 错误 1

搜索半天,终于在谷歌上得到解惑,百度有点不给力:

Bug 354965 – media-video-mplayer fails to compile against media-libs-libpng-1_5_x

竟然是一BUG,没办法,只能用最新版的了。

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

又有错误提示
No FFmpeg checkout, press enter to download one with git or CTRL+C to abort
解决方案:
You may need to install git client  and press enter  during the above warning time

直接回车,自动安装git获取FFmpeg

# ./configure 没办法,再来一次configure

错误

Error: yasm not found, use --yasm='' if you really want to compile without

说明YASM没有找到

# git clone git://github.com/yasm/yasm.git

# wget 

安装 yasm 后重新进入mplayer下

# make -j 2

我的机器是E5300双核


# make install

成功


# svn update
# ldconfig
# mplayer --help

完毕!

# mencoder -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=500 -lavfopts format=flv -srate 22050 -oac mp3lame -lavcopts acodec=mp3:abitrate=56  PrettyGirlWillGotMarried.mpg -o  PrettyGirlWillGotMarried.flv -ofps 16

错误
MPlayer was compiled without libmp3lame support.

没安装lame
# wget 
# tar -zxvf lame-3.98.4.tar.gz
# cd lame-3.98.4
#  ./configure  --enable-shared
# make && make install

重新编译一遍Mplayer,成功

呵呵,压缩率50%


===================================

rm -rf /usr/local/lib/codecs/
rm -rf /usr/local/share/mplayer/skins/iTunes/
rm -f /usr/local/share/mplayer/skins/default
cd /root/MPlayer-1.0rc4
make uninstall


常见问题:

1,有时播放有错误信息就在界面参数里调调audio、video的drivers
我这里装完了后,把autido的driver 调为了alsa,video的为X11,然后能播放音乐和视频了rm/rmvb的也能播放

2,声卡选择里如果没有alsa,那么configure时显示的是checking for ALSA audio     no
那么安装alsa-lib-devel包后重新configure再编译就可以了
pulse也是同理安装pulseaudio-libs-devel包后编译安装

3,全屏后,影音图像没有变大,没有自适应屏幕大小。

编辑自己主目录的mplayer配置文件,我的是~/.mplayer/config,添加一条 zoom=yes,然后播放影音按F键再试试。

4,显示Error: X11 support required for GUI compilation

安装gtk2和其依赖的包

阅读(3080) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~