fedora专题

mplayer源代码包在fedora中的安装方法详解

本原创文章属于《Linux大棚》博客。

博客地址为http://roclinux.cn

文章作者为roc

希望您能通过捐款的方式支持Linux大棚博客的运行和发展。请见“关于捐款

==

虽然mplayer的安装方法已经不是什么技术活,但最近有不少同学在询问我关于mplayer的安装方法的问题。我一贯推荐它们源代码包的安装,虽然步骤有些复杂,但解码器和二进制程序都尽在掌握,心里踏实。

===

1

下载如下这些软件:

all-20071007.tar.bz2

windows-all-20071007.zip

Blue-1.7.tar.bz2

MPlayer-1.0rc2.tar.bz2

2

all-20071007.tar.bz2解压到/usr/lib/codecs中(如果没有相应目录就自己建一个),命令如下:

tar -xjvf all-20071007.tar.bz2

cd all-20071007

cp -r * /usr/lib/codecs

将windows-all-20071007.zip解压到/usr/lib/win32(如果没有相应目录就自己建一个),命令如下:

unzip windows-all-20071007.zip

cd windows-all-20071007

cp -r * /usr/lib/win32

3

下载四个补丁:

demux_audio_fix_20080129.diff

demux_mov_fix_20080129.diff

stream_cddb_fix_20080120.diff

url_fix_20080120.diff

4

解压MPlayer-1.0rc2.tar.bz2后打补丁,最后configure,命令步骤如下:

tar -xjvf MPlayer-1.0rc2.tar.bz2

cd MPlayer-1.0rc2

cp 四个补丁 . (这个步骤是拷贝刚才下载的四个补丁到当前目录中)

patch -p0 <filename.diff (用四个补丁分别替换filename.diff字符串)

./configure –prefix=/usr/local/mplayer –enable-gui –enable-freetype –codecsdir=/usr/lib/codecs/ –win32codecsdir=/usr/lib/win32/

此处的–prefix和–codecsdir和–win32codecsdir都是可以自定义的。但建议非高手不要自己改,按默认即可。

enable-gui用于安装mplayer的图形界面。如果你只在命令行工作,那么当然可以省去这个选项。

还有一些其他的选项,如果你在未来可能会进行格式转换,那么你最好加上下列这堆参数:

–enable-libmp3lame \
–enable-libogg \
–enable-libvorbis \
–enable-libtheora \
–enable-libfaac \
–enable-libfaad \
–enable-liba52 \
–enable-libx264 \
–enable-libxvid \
–enable-libamr-nb \
–enable-libamr-wb \
–enable-gpl \
–enable-pp \
–enable-pthreads \
–disable-debug \
–enable-shared \

5

编译、安装,命令如下:

make

make install

6

安装皮肤Blue-1.7.tar.bz2,命令步骤如下:

tar jxvf Blue-1.7.tar.bz2

mv Blue /usr/local/mplayer/share/mplayer/skins/

cd /usr/local/mplayer/share/mplayer/skins/

mv Blue default

7

如果这个时候你运行你的gmplayer(gmplayer是mplayer的gui版)会报错,因为还有字体没有安装。

linux/usr/share/fonts中随便找一个喜欢的ttf字体,将它更名为subfont.ttf

然后拷贝到~/.mplayer/目录下即可(如果你对~符号不太了解,可以去百度查查关键字“linux 家目录 符号”)

8

享受mplayer吧!

到/usr/local/mplayer中的bin目录下去找gmplayer可执行文件,执行即可!

9

如果播放电影时总是弹出某个错误的话,可以这样解决。进入mplayer的preference,然后点击Audio,去掉“Enable equalizer”前面的小勾,应该可以解决问题。如果不行,另寻高就:D

10

如果你make时总是报关于ivtv的错误,那就svn一个最新的mplayer版本吧,因为ivtv错误是软件本身的一个bug。svn最新版本的方法是:

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

over~

18条评论

  1. 这么详细 谢谢分享 不过我这有三个问题请教一下
    第一个:我在./configure –prefix=/usr/local/mplayer –enable-gui –enable-freetype –codecsdir=/usr/lib/codecs/ –win32codecsdir=/usr/lib/win32/ 时 出现 Unknown parameter: –win32codecsdir=/usr/lib/win32/ 不知道如何解决 我的 /usr/lib/ 存在 win32
    第二个:我去出–win32codecsdir=/usr/lib/win32/ 后执行成功 不知道会不会有什么影响
    最后一个 我已经安装了mplayer 但是现在打开时总是出现黑屏 不知掉是怎么回事 所以才按照你的方法安装的 但是我没有卸载 直接不该安装 不知道会不会有问题

  2. fc11 mplayer1.0rc2make通不过的,只能装svn版的。即使使用disable-ivtv,make也会出错的。只能下载svn版本编译。也可以yum。

  3. @黄成,
    修改源代码libvo/video_out.c,中101行处(没有备份以前的,大约是这个地方,所以给你贴了一段),将这一段代码:

    #ifdef HAVE_DIRECTX
    extern vo_functions_t video_out_directx;
    #endif
    #ifdef HAVE_DXR2
    extern vo_functions_t video_out_dxr2;
    #endif
    extern vo_functions_t video_out_dxr3;
    #ifdef HAVE_IVTV
    extern vo_functions_t video_out_ivtv;
    #endif
    #ifdef HAVE_V4L2_DECODER
    extern vo_functions_t video_out_v4l2;

    修改为:

    #ifdef HAVE_DIRECTX
    extern vo_functions_t video_out_directx;
    #endif
    #ifdef HAVE_DXR2
    extern vo_functions_t video_out_dxr2;
    #endif
    //就是这里: //下面三行修改过,添加了编译预处理宏,搭配--disable-ivtv配置参数使用
    #ifdef HAVE_DXR3 //新加行
    extern vo_functions_t video_out_dxr3;
    #endif //新加行
    //以上三行修改过,源码只有下面一行:
    //extern vo_functions_t video_out_dxr3;
    #ifdef HAVE_IVTV
    extern vo_functions_t video_out_ivtv;
    #endif
    #ifdef HAVE_V4L2_DECODER
    extern vo_functions_t video_out_v4l2;

  4. [root@localhost MPlayer-1.0rc2]# make
    make -C libvo libvo.a
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libvo’
    make[1]: `libvo.a’ is up to date.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libvo’
    make -C libao2
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libao2′
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libao2′
    make -C input
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/input’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/input’
    make -C vidix
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/vidix’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/vidix’
    make -C gui
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/gui’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/gui’
    make -C libmpcodecs
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libmpcodecs’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libmpcodecs’
    make -C libaf
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libaf’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libaf’
    make -C libmpdemux libmpdemux.a
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libmpdemux’
    make[1]: `libmpdemux.a’ is up to date.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libmpdemux’
    make -C stream
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/stream’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/stream’
    make -C libswscale
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libswscale’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libswscale’
    make -C libvo libosd.a
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libvo’
    make[1]: `libosd.a’ is up to date.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libvo’
    make -C libavformat
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libavformat’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libavformat’
    make -C libavcodec
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libavcodec’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libavcodec’
    make -C libavutil
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libavutil’
    make[1]: Nothing to be done for `all’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libavutil’
    make -C loader
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/loader’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/loader’
    make -C mp3lib
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/mp3lib’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/mp3lib’
    make -C liba52
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/liba52′
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/liba52′
    make -C libmpeg2
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libmpeg2′
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libmpeg2′
    make -C libfaad2
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libfaad2′
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libfaad2′
    make -C dvdread
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/dvdread’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/dvdread’
    make -C libdvdcss
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libdvdcss’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libdvdcss’
    make -C libass
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/libass’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/libass’
    make -C osdep
    make[1]: Entering directory `/home/flyman/Download/MPlayer-1.0rc2/osdep’
    make[1]: Nothing to be done for `libs’.
    make[1]: Leaving directory `/home/flyman/Download/MPlayer-1.0rc2/osdep’
    cc -o mplayer mplayer.o m_property.o mp_fifo.o mp_msg.o mixer.o parser-mpcmd.o subopt-helper.o command.o asxparser.o codec-cfg.o cpudetect.o edl.o find_sub.o get_path.o m_config.o m_option.o m_struct.o mpcommon.o parser-cfg.o playtree.o playtreeparser.o spudec.o sub_cc.o subreader.o vobsub.o unrarlib.o libvo/libvo.a libao2/libao2.a input/libinput.a vidix/libvidix.a gui/libgui.a libmpcodecs/libmpcodecs.a libaf/libaf.a libmpdemux/libmpdemux.a stream/stream.a libswscale/libswscale.a libvo/libosd.a libavformat/libavformat.a libavcodec/libavcodec.a libavutil/libavutil.a libpostproc/libpostproc.a loader/libloader.a mp3lib/libmp3.a liba52/liba52.a libmpeg2/libmpeg2.a libfaad2/libfaad2.a tremor/libvorbisidec.a dvdread/libdvdread.a libdvdcss/libdvdcss.a libass/libass.a osdep/libosdep.a -lXext -lX11 -lpthread -lXv -lXinerama -lXxf86vm -lXxf86dga -lGL -ldl -lSDL -lpthread -lesd -laudiofile -lm -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lglib-2.0 -Wl,-z,noexecstack -lncurses -lpng -lz -ljpeg -lungif -lasound -ldl -lpthread -lfreetype -lfontconfig -lz -lpthread -ldl -rdynamic -lm
    libvo/libvo.a(video_out.o):(.data+0x44): undefined reference to `video_out_ivtv’
    collect2: ld returned 1 exit status
    make: *** [mplayer] Error 1
    愿意为搞定了 可是 进行了漫长的编译之后 最后 还是出现了错误信息?
    该怎么解决?

    1. @kder,
      ./configure –prefix=/usr/local/mplayer –enable-gui –enable-freetype –disable-ivtv –codecsdir=/usr/lib/codecs/ –win32codecsdir=/usr/lib/wincodecs/ –language=zh_CN
      make之后出现:
      libvo/libvo.a(video_out.o):(.data+0x44): undefined reference to `video_out_ivtv’
      依就无法安装!!

      PS:OS is Fedora 11

  5. 版主啊, 我的问题依然有呢,我将codecs跟你的一样。但做到make就出现以下问题啦!
    ./version.sh `cc -dumpversion`
    cc -I./libavcodec -I./libavformat -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -I. -I./libavutil -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAVE_CONFIG_H -I/usr/include/SDL -D_REENTRANT -I/usr/include/freetype2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -c -o mplayer.o mplayer.c
    In file included from mplayer.c:794:
    cfg-mplayer.h:64: warning: redundant redeclaration of ‘enqueue’
    mplayer.c:230: warning: previous definition of ‘enqueue’ was here
    mplayer.c: In function ‘main’:
    mplayer.c:2664: warning: passing argument 2 of ‘guiGetEvent’ from incompatible pointer type
    cc -I./libavcodec -I./libavformat -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -I. -I./libavutil -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAVE_CONFIG_H -I/usr/include/SDL -D_REENTRANT -I/usr/include/freetype2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -c -o vobsub.o vobsub.c
    make -C libvo libvo.a
    make[1]: Entering directory `/home/winson/下载/MPlayer-1.0rc2/libvo’
    cc -I../libavcodec -I../libavformat -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -I.. -I../libavutil -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAVE_CONFIG_H -I/usr/include/SDL -D_REENTRANT -I/usr/include/freetype2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -c -o vo_ivtv.o vo_ivtv.c
    vo_ivtv.c: In function ‘ivtv_reset’:
    vo_ivtv.c:79: error: storage size of ‘sd’ isn’t known
    vo_ivtv.c:80: error: storage size of ‘sd1’ isn’t known
    vo_ivtv.c:84: error: ‘IVTV_STOP_FL_HIDE_FRAME’ undeclared (first use in this function)
    vo_ivtv.c:84: error: (Each undeclared identifier is reported only once
    vo_ivtv.c:84: error: for each function it appears in.)
    vo_ivtv.c:87: error: ‘IVTV_IOC_STOP_DECODE’ undeclared (first use in this function)
    vo_ivtv.c:97: error: ‘IVTV_IOC_START_DECODE’ undeclared (first use in this function)
    vo_ivtv.c:80: warning: unused variable ‘sd1’
    vo_ivtv.c:79: warning: unused variable ‘sd’
    make[1]: *** [vo_ivtv.o] Error 1
    make[1]: Leaving directory `/home/winson/下载/MPlayer-1.0rc2/libvo’
    make: *** [libvo/libvo.a] 错误 2
    [root@leejincong MPlayer-1.0rc2]# chmod 777 ./
    [root@leejincong MPlayer-1.0rc2]# make
    make -C libvo libvo.a
    make[1]: Entering directory `/home/winson/下载/MPlayer-1.0rc2/libvo’
    cc -I../libavcodec -I../libavformat -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -I.. -I../libavutil -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 -march=native -mtune=native -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DHAVE_CONFIG_H -I/usr/include/SDL -D_REENTRANT -I/usr/include/freetype2 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -c -o vo_ivtv.o vo_ivtv.c
    vo_ivtv.c: In function ‘ivtv_reset’:
    vo_ivtv.c:79: error: storage size of ‘sd’ isn’t known
    vo_ivtv.c:80: error: storage size of ‘sd1’ isn’t known
    vo_ivtv.c:84: error: ‘IVTV_STOP_FL_HIDE_FRAME’ undeclared (first use in this function)
    vo_ivtv.c:84: error: (Each undeclared identifier is reported only once
    vo_ivtv.c:84: error: for each function it appears in.)
    vo_ivtv.c:87: error: ‘IVTV_IOC_STOP_DECODE’ undeclared (first use in this function)
    vo_ivtv.c:97: error: ‘IVTV_IOC_START_DECODE’ undeclared (first use in this function)
    vo_ivtv.c:80: warning: unused variable ‘sd1’
    vo_ivtv.c:79: warning: unused variable ‘sd’
    make[1]: *** [vo_ivtv.o] Error 1
    make[1]: Leaving directory `/home/winson/下载/MPlayer-1.0rc2/libvo’
    make: *** [libvo/libvo.a] 错误 2

  6. [alge@localhost MPlayer-1.0rc2]$ ./configure -prefix=/usr/local/lib64/mplayer -enable-gui -enable-freetype -codecsdir=/usr/lib64/codecs/ -win32codecsdir=/usr/lib/win32/
    Unknown parameter: -prefix=/usr/local/mplayer

    why?

  7. 先谢谢gcell的关注:)
    第一个问题:windows-essential似乎是为了照顾一些老的unix播放器,比如xine等。这个是我通过一些网上资料的只言片语得出的,未必准。呵呵
    第二个问题:在http://www.mplayerhq.hu/design7/news.html网页上有,每个diff都分别进行了解释。
    呵呵
    欢迎这样的交流:)

  8. 很好的文章啊,顶一下

    另外有两个问题:
    1.all-codec 和windows-essential这两个有什么不同?我一直都只装all-codec的

    2.文中提到的四个补丁都有什么用?

    麻烦博主指点一下,谢谢!

发表您的评论

请您放心,您的信息会被严格保密。必填项已标识 *