redhat下ffmpeg+mencoder安装教程。如果只需要转到flv,装mencoder和codecs就可以了,如果还需要截图或者其他 功能,就要装ffmpeg和相关解码包。ffmpeg支持的格式没有前者多,但是速度比较快,参数也很简单。另外我们还需要转换到rm,找了很久都没找到 基于前述两种软件的解决方法。在对转换速度不具特殊需求的情况下,我使用Helix Producer for linux来解决该问题,这同时也是real的人所建议的。
在Ubuntu下测试的时候,只需要一句话就装完了。
sudo apt-get install w32codecs mplayer ffmpeg
下面记录了redhat as4下的安装过程。
安装apache的runtime模块apr和apr-util,这样才能安装svn:
http://apr.apache.org/
先装apr,再装apr-util的时候要用 –with-apr=apr源码路径
安装subversion,这样才能装接下来的软件。
wget http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gz
tar zvxf subversion-1.3.2.tar.gz
cd subversion-1.3.2
./configure –with-apr=apr的源码路径 –with-apr-util=apr-util的源码路径
安装faad2包:
http://www.audiocoding.com/modules/mydownloads/
解压后如果configure出错,需要如下修改
echo > plugins/Makefile.am
echo > plugins/xmms/src/Makefile.am
sed -i ‘/E_B/d’ configure.in
autoreconf -vif
./configure –prefix=/usr –with-mp4v2 –enable-shared
安装faac:
下载地址同上,如果bootstrap出错,需要如下修改(因为Unix格式问题)
sed -i ‘s/\r//’ bootstrap
sed -i ‘s/\r//’ configure.in
./bootstrap
./configure –prefix=/usr –with-mp4v2 –enable-shared
安装mp3lame:
http://lame.sourceforge.net/download.php
./configure –enable-shared –prefix=/usr
安装xvid,ffmpeg貌似带了的,实际是个wrap
wget http://downloads.xvid.org/downloads/xvidcore-1.1.0.tar.gz
tar zvxf xvidcore-1.1.0.tar.gz
./configure –prefix=/usr
安装x264
svn co svn://svn.videolan.org/x264/trunk x264
./configure –prefix=/usr –enable-shared
安装liba52:
http://liba52.sourceforge.net/
安装libdts:
http://download.chinaunix.net/download/0006000/5785.shtml
由于项目不需要支持3gp,没有装3gp的解码包,见参考链接。
都装齐了就可以编译ffmpeg:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
./configure –prefix=/usr –enable-gpl –enable-shared –enable-libmp3lame –enable-libogg –enable-libvorbis –enable-xvid –enable-liba52 –enable-liba52bin –enable-libdts –enable-pp –enable-libfaad –enable-libfaadbin –enable-libfaac –enable-x264 –enable-pthreads –disable-ffserver –disable-ffplay
使用的时候很方便,一般来说:
ffmpeg -i 源文件 -o 目标文件 [-codec 编码方式] [-b 码率]就可以了,码率默认200k,编码默认为目标扩展名类型。
下面安装mplayer/mencoder:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
安装mencoder需要的codecs:
http://www1.mplayerhq.hu/MPlayer/releases/codecs/
(现在最新的是mplayer-codecs-20061022-1.i386.rpm)安装到usr/local/lib/codecs
安装Helix DNA Producer
https://helix-producer.helixcommunity.org/downloads
转flv的参数:
mencoder zhou.rm -o ps2.flv -of lavf -oac mp3lame -lameopts abr:br=32:mode=3 -ovc lavc -lavcopts vcodec=flv:vbitrate=150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=350:-3 -sws 2
由于producer for Linux只认识uncompress的视频文件,所以转rm要先中转:
mencoder ps2.mpeg -ovc raw -oac pcm -o ps2.avi
producer -i ps2.avi -o ps2.rm