我感谢我正在使用的Drupal

CentOS 5上安装FFMPEG

[内容摘自:http://www.php-oa.com]

yum install -y automake autoconf libtool gcc gcc-c++

1.下载需要的解码器

wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz

wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz

wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz

wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz

wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz

wget ftp://ftp.videolan.org:21//pub/videolan/x264/snapshots/x264-snapshot-20090107-2245.tar.bz2

wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz

wget http://down1.chinaunix.net/distfiles/libdts-0.0.2.tar.gz

 

2.解压安装

解压

for i in *.tar.gz; do tar -xzvf "$i"; done

for i in *.tar.bz2; do tar -xjvf "$i"; done



安装的参数

a52dec: ./configure –enable-shared=PKGS && make && make install

faac: ./bootstrap && ./configure && make && make install

faad2: ./bootstrap && ./configure && make && make install

xvidcore: cd build/generic; ./configure && make && make install

lib: ./configure --disable-asm && make && make install

x264: ./configure –enable-mp4-output –enable-shared –enable-pthread && make && make install

lame: ./configure && make && make install

yasm: ./configure && make && make install

 

最后下载和安装ffmpeg

我是使用的svn同步比较新的,如果有时不能编译通过,可以考虑不使用最新的,不过要提示一下,就是连接这个网站,被我们国家的防火墙给kill掉了。需要各位自己想法子.

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

编译参数

./configure –enable-gpl  –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-swscale –enable-avfilter –enable-pthreads –enable-libxvid –enable-libx264 –enable-libmp3lame  –enable-libfaac –disable-ffserver –disable-ffplay

 

支持rm和rmvb

对rm和rmvb,只有ffmpeg是不行的,还需要下面的mplayer

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

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2

wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2

for i in *.tar.bz2; do tar -xjvf "$i"; done

cp -rf essential-20071007/* /usr/local/lib/codecs

cp -rf all-20071007/* /usr/local/lib/codecs

cp -rf essential-amd64-20071007/* /usr/local/lib/codecs

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

 

更新动态链接库

因为是编译器安装的,所以需要让系统可以找到动态链接库

#echo "/usr/local/lib" >> /etc/ld.so.conf

#echo "/usr/lib" >> /etc/ld.so.conf

#ldconfig

到这基本就安装完了

最基本的几个命令(一定要了解的)

显示支持的格式,不过好象加参数时,加其中的会有问题,看来参数和支持的格式是不一样的

 $ ffmpeg -formats 

 

显示视频的相关信息,如时长,文件声音和视频格式之类的信息

 ffmpeg -i abc.ts

 

查看可以加什么参数 

ffmpeg -h

mplayer获取影片信息

mplayer -identify movie-filename -nosound -vc dummy -vo null

使用ffmpeg从视频中抓图

ffmpeg -i 原视频文件路径  -y -f image2 -ss 8 -t 0.001 -s 图象大小(400×300)  图片存放路径

使用ffmpeg给视频转换成flv

ffmpeg -i  原视频文件路径  -o 目标文件路径 -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=视频码流:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=高:宽 -ofps 12 -srate 22050′)

ffmpeg   00:04:00 -t 00:08:00 -i -vcodec copy -acodec copy aaa.avi

FAQ

1.出现如下提示

-soname,libx264.so.65 -lm -lpthread -lgpac_static -s

/usr/bin/ld: cannot find -lgpac_static

collect2: ld returned 1 exit status

make: *** [libx264.so.65] Error 1

解决方法

yum install zlib-devel

wget http://internap.dl.sourceforge.net/sourceforge/gpac/gpac-0.4.5.tar.gz

wget http://internap.dl.sourceforge.net/sourceforge/gpac/gpac_extra_libs-0.4.5.tar.gz

tar -zxf gpac-0.4.5.tar.gz

tar -zxf gpac_extra_libs-0.4.5.tar.gz

cd gpac_extra_libs

cp -r * ../gpac/extra_lib

cd ../gpac

chmod +x configure

./configure

make lib

make apps

make install-lib

make install

cp bin/gcc/libgpac.so /usr/lib

注意,使用下面的参数出错

 –enable-liba52 –enable-liba52bin

 查看源码发现中包括了ac3

评论

发表新评论

此内容将保密,不会被其他人看见。 如果这是你的 Gravatar 账户,将会显示你的头像。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img>
  • You can use the <go> tags just like the <a> for nicer urls.

更多关于格式化选项的信息

验证码
这是为了测试你是否是一个人类(相对机器来说)的游客和防止自动的垃圾提交。
1 + 0 =
做一下这个数学题,把答案给我。