linux下安装FFMPEG全纪录
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
怎样安装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后面加上选项,前提是已经编译安装了这种编码库。
[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_PA TH=/usr/local/lib/
注意:这种方案经验证,关闭终端再打开终端,这个环境变量就失效了,也就是说只对当前终端有效
最终解决方案:
//**********************************************
因为找不到库文件。编辑/etc/ld.so.conf,加入一行:
/usr/local/lib
执行ldconfig命令即可。
//**************************************
然后添加软链接。
ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
安装成功后,测试:
ffmpe g -i /home/admn/public_html/ConvertVedioT est/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.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -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 functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video format supported by ffmpeg (mov, avi, mpg, wmv...)
USAGE
If you've the installed ffmpeg-php extension as a shared library but haven't set
it to auto-load in your php.ini file, you'll need to use the PHP dl() function to make ffmpeg-php available to your scripts. Add the following PHP code to the beginning of scripts you want to call ffmpeg-php methods in.
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
// load extension
if(!extension_loaded($extension)) {
dl($extension_soname) or die("Can't load extension $extension_fullna
me\n");
}
?>
ffmpeg最后配置为:
./configure --disable-mmx --enable-gpl --enable-shared
--enable-libmp3lame --enable-libvorbis --enable-libxvid
--enable-libx264 --enable-pthreads --disable-ffserver --disable-ffplay 安装ffmpeg最后结果为:
安装ffmpeg-php结果为: