Linux下自动安装mplayer,虽然有些不完美(不能检测yasm是否安装)但先发布一版吧。支持红帽系列x86/x86_64 系统(需要yum安装一些包),因为对大便系列没有研究所有暂不支持。测试环境scientific linux 6 x86_64。我在测试的时候有时安装完没有声音或播放时很卡,请通过“首选项”修改一下配置。
使用方法:
wget http://mplayer-install.googlecode.com/files/mplayer-install-2011.09.07.tar.bz2
tar jxvf mplayer-install-2011.09.07.tar.bz2
cd mplayer-install
./mplayer-linux-install.sh
粘贴一下 mplayer-linux-install.sh 的代码
#!/bin/bash
# description: This shell script takes care of install mplayer
# created by kethinc: http://blog.kethinc.com
# codecs: http://www.mplayerhq.hu/MPlayer/releases/codecs/
# skins: http://www.mplayerhq.hu/MPlayer/skins/
# fonts: http://www.mplayerhq.hu/MPlayer/contrib/fonts/chinesefonts/gb2312-ming.tar.bz2
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
cur_dir=$(pwd)
#if [ “$1” = “–help” ]; then
#
#fi
# 检查是否为root用户
if [ $(id -u) != “0” ]; then
echo “执行此脚本必须为root用户”
echo “You must be root to run this script”
exit 1
fi
# 安装编译工具及一些可能用到的包
yum -y install gcc gcc-c++ autoconf make libjpeg libjpeg-devel libpng libpng-devel libXpm libXpm-devel freetype freetype-devel
# 安装yasm
tar jxvf yasm-1.1.0.tar.bz2
cd yasm-1.1.0
./configure
make
make install
cd $cur_dir
# 安装解码库
tar jxvf codecs-20110131.tar.bz2 -C /usr/lib
if [ $(uname -i) = ‘x86_64’ ] ; then
tar jxvf codecs-20071007-amd64.tar.bz2 -C /usr/lib
fi
# 解压源码包
tar jxvf mplayer-export-2011-09-05.tar.bz2
tar jxvf ffmpeg-git-2011-09-07-3961695.tar.bz2 -C mplayer-export-2011-09-05
# 解压ffmpeg到源码文件目录
cd mplayer-export-2011-09-05
./configure –enable-gui –enable-x11 –enable-freetype –enable-menu –codecsdir=/usr/lib/codecs/ –language=zh_CN
# –disable-mencoder 关闭mencoder。mplayer自带的多媒体格式转换工具
# –enable-gui 安装图形化用户界面
# –enable-freetype 调节字体
# –codecsdir=/usr/lib/codecs/ 解码器目录
make
make install
# 安装主题文件
cd ${cur_dir}/skins
tar jxvf default.tar.bz2 -C /usr/local/share/mplayer/skins/
tar jxvf Ater-1.2.tar.bz2 -C /usr/local/share/mplayer/skins/
# 安装字体文件
cd ${cur_dir}
cp ./YaHei.Consolas.1.11b.ttf /usr/local/share/mplayer/subfont.ttf
chmod 666 /usr/local/share/mplayer/subfont.ttf
#cd /usr/lib/codecs/ chcon -t textrel_shlib_t /usr/lib/codecs/drvc.so
# 在RedHat Enterprise server 5中SELinux显示出错误的解决方案
/usr/local/bin/gmplayer