linux下安装FFMPEG全纪录
怎样安装ffmpeg?
1,cd /usr/local/src
下载最新版本的ffmpeg:
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
2,cd ffmpeg
./configure
make && make install
以上是安装不带任何解码库的ffmpeg。
使用ffmpeg命令进行测试安装是否成功。例如:
ffmpeg --help
II,要加入则在./configure后面加上选项,前提是已经编译安装了这种编码库。例如:
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
测试的结果为:
[root@ip-208-109-221-163 ffmpeg]# ffmpeg --help
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
找不到libavdevice.so.52库。
解决方案:(成功解决问题的方案)
首先到/usr/local/lib/目录下去查看是否有libavdevice.so.52,然后设置环境变量:
export LD_LIBRARY_PATH=/usr/local/lib/
注意:这种方案经验证,关闭终端再打开终端,这个环境变量就失效了,也就是说只对当前终端有效
最终解决方案:
//**********************************************
因为找不到库文件。编辑/etc/ld.so.conf,加入/usr/local/lib
执行ldconfig即可。ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
安装成功后,测试:
ffmpeg -i /home/admn/public_html/ConvertVedioTest/rjmj.mpeg -ab 56 -ar 22050 -b 500 -r 15 -qscale 4 -s 640*480 rjmj.flv
转换成功。
等等。ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
最基本的需要这些东西:
FFMPEG
LAME Mp3 Audio Codec (Requred for mpg, flv, avi, wmv etc files)
AMR Audio Codec (Required for 3gp video files)
XVID Audio Codec
FFMPEG-PHP
安装FFMPEG-PHP:
FFMPEG-PHP# ./configure出现如下错误:??
checking for ffmpeg headers... configure: error: ffmpeg headers not found. Make sure you've built ffmpeg as shared libs using the --enable-shared option
解决方案:
换成ffmpeg-php-0.6.0.tbz2版本进行安装,安装过程没有问题。
ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image