安装mplayer/mencoder

来源:互联网 发布:python condition 编辑:程序博客网 时间:2024/05/21 10:16
安装mplayer/mencoder (2008-05-27 09:47:57)
环境:redhat as5
[root@test ~]# uname -a
Linux test.suantop.com 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT2007 i686 i686 i386 GNU/Linux
如果只需要转到flv,装mencoder和codecs就可以了,如果还需要截图或者其他功能,就要装ffmpeg和相关解码包。ffmpeg支持的格式没有前者多,但是速度比较快,参数也很简单.我现在只尝试mplayer/mencoder的安装!
需要svn--
[root@test ~]# rpm -qa|grep subversion
subversion-1.4.2-2.el5
已经有了如果没有需要下载编译安装,编译安装的前提还要apr/apr-util安装apache的runtime模块apr和apr-util,这样才能安装svn:
http://apr.apache.org/
先装apr,再装apr-util的时候要用–with-apr=apr源码路径
安装subversion,这样才能装接下来的软件。
wgethttp://subversion.tigris.org/downloads/subversion-***.tar.gz
tar zvxf subversion-***.tar.gz
cd subversion-***
./configure –with-apr=apr的源码路径–with-apr-util=apr-util的源码路径
安装一些需要的插件
Lame
Lame is an open source MP3 encoder. MPlayer uses lame forcompressing audio into MP3 audio when encoding files from MPEG orother sources. Lame is not required to decode MP3 audio.
http://lame.sourceforge.net/download.php
Current Versions
* The current release version of LAME is 3.97
# tar zxvf lame-3.97.tar.gz
# cd lame-3.97
# ./configure --enable-shared --prefix=/usr
这里推荐尽量装在/usr下,默认是装在/usr/local下。这样mplayer编译都能顺利的找到库文件
# make
# make install
# whereis lame
/usr/bin/lame
支持Ogg Vorbis:
as自带相应的rpm包,如下rpm包
# rpm -qa|grep libvor
libvorbis-1.1.2-3.el5.0
libvorbis-devel-1.1.2-3.el5.0
# rpm -qa|grep libogg
libogg-devel-1.1.3-3.el5
libogg-1.1.3-3.el5
支持xvid/x264,现在最流行的两种高质量的压缩格式
http://www.xvid.org/Downloads.43.0.html
# wgethttp://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
# tar zxvf xvidcore-1.1.3.tar.gz
# cd xvidcore-1.1.3
# ./configure --prefix=/usr 报错
于是查看/xvidcore-1.1.3/doc/INSTALL
# cd build/generic/
The next step allows you to configure the xvid sources.
 
# cd ${xvidcore}/build/generic
  # ./configure
再次configure
[root@test generic]# ./configure --prefix=/usr
# make
---------------------------------------------------------------
 XviD has been successfully built.

 * Binaries are currently located in the '=build'directory
 * To install them on your system, you can run '#make install'
   as root.
---------------------------------------------------------------

# make install
  D: /usr/lib
  I: /usr/lib/libxvidcore.so.4.1
  I: /usr/lib/libxvidcore.a
  D: /usr/include
  I: /usr/include/xvid.h
x264的获取
# wgetftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080522-2245.tar.bz2
# tar -xjvf x264-snapshot-20080522-2245.tar.bz2
# cd x264-snapshot-20080522-2245
# ./configure --prefix=/usr --enable-shared
No suitable assembler found.  x264 will be severaltimes slower.
Please install 'yasm' to get MMX/SSE optimized code.
./version.sh: line 2: git-rev-list: command not found
Platform:   X86
System:    LINUX
avis input: no
mp4 output: no
pthread:   yes
gtk:       no
debug:     no
gprof:     no
PIC:       no
shared:    yes
visualize:  no

You can run 'make' or 'make fprofiled' now.
# make
# make install
install -d /usr/bin /usr/include
install -d /usr/lib /usr/lib/pkgconfig
install -m 644 x264.h /usr/include
install -m 644 libx264.a /usr/lib
install -m 644 x264.pc /usr/lib/pkgconfig
install x264 /usr/bin
ranlib /usr/lib/libx264.a
ln -sf libx264.so.59 /usr/lib/libx264.so
install -m 755 libx264.so.59 /usr/lib

安装mencoder需要的codecs:
http://www1.mplayerhq.hu/MPlayer/releases/codecs

[root@test ~]# wgethttp://www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-20061022-1.i386.rpm
[root@test ~]# rpm -ivh mplayer-codecs-20061022-1.i386.rpm
warning: mplayer-codecs-20061022-1.i386.rpm: Header V3 DSAsignature: NOKEY, key ID b6d6aef5
Preparing...               ########################################### [100%]
  1:mplayer-codecs        ########################################### [100%]
[root@test lib]# rpm -qa|grep codecs
mplayer-codecs-20061022-1
可以whereis codecs
[root@test lib]# /usr/lib/codecs/
atrc.so.6.0 drvc.so     sipr.so.6.0  tokr.so.6.0 
cook.so     dspr.so.6.0  tokf.so.6.0 vid_3ivX.xa

安装到usr/lib/codecs
下面安装mplayer/mencoder:
http://www.mplayerhq.hu/design7/dload.html

Downloading MPlayer from Subversion
You can also get MPlayer via Subversion. Issue the followingcommand to get the latest sources:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
A directory named mplayer will be created in the currentdirectory
[root@test ~]# svn checkout svn://svn.mplayerhq.hu/mplayer/trunkmplayer

有些慢不如直接下载tar.bz2的包
http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
# tar -xjvf MPlayer-1.0rc2.tar.bz2
# cd MPlayer-1.0rc2
[root@test MPlayer-1.0rc2]# ./configure --prefix=/usr/local--enable-gui --enable-largefiles  --enable-gif--enable-png --enable-jpeg --language=zh_CN--codecsdir=/usr/lib/codecs/
[root@test MPlayer-1.0rc2]# make
[root@test MPlayer-1.0rc2]# make install
[root@test MPlayer-1.0rc2]# whereis mplayer
mplayer: /usr/local/bin/mplayer /usr/local/etc/mplayer
[root@test MPlayer-1.0rc2]# whereis mencoder
mencoder: /usr/local/bin/mencoder

# /usr/local/bin/mencoder endless_love_I.avi -o avi.flv -of lavf-oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcoptsvcodec=flv:vbitrate=150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate22050
测试将62M的endless_love_I.avi压成了11M 的avi.flv
说明:configure-Mplayer时提示
Checking for LIVE555 Streaming Media libraries ... no
#可以参考http://cmuch.com/article.asp?id=168
#LIVE555 provides additional support for RTP/RTCP/RTSP/SIPmultimedia streaming in MPlayer. This is useful if you plan to use#the MPlayer-plugin for Mozilla/FireFox. (Note: Prior to Nov 2005,LIVE555 was known as LIVE.COM)
#Latest Release: 2006.12.18 (updated frequently)
#Download: http://www.live555.com/liveMedia/public/
关于mencoder的参数自己不晓得。都是网上看到的参考文章如下:
http://wf.xplore.cn/read.php/90.htm
http://www.jcwcn.com/html/geshizh/14_12_25_632.html
http://www.lupaworld.com/bbs/redirect.php?fid=253&tid=5477&goto=nextnewset
http://su27.org/2007/06/12/ffmpeg-mencoder/
http://blog.verycd.com/dash/showentry=35982
http://blog.5ilinux.com/archives/2006/08/ffmpeg.html
http://cmuch.com/article.asp?id=168