首页 / 配置搭建 / 内容详情

Linux环境下安装视频处理库ffmpeg

发布时间:2015-06-05 作者:admin 来源:JTopCMS 阅读:

JTopCMS使用ffmpeg处理视频文件,要求操作系统存在ffmpeg软件。默认系统自带windows版本ffmpeg,若在Linux下, 可按照以下流程安装(以CentOS7.X 为例,因环境各不相同,本文起参考作用,出现非相关问题可按提示搜索解决方案)。

本文提及相关软件可在本站下载 :    ffmpegLiunxFull.zip 


编译安装FFmpeg 要支持xvid、x264、mp3、ogg、amr、faac

libfaac    faac格式的编解码包
libmp3lame    mp3格式编解码包
libopencore-amrwb libopencore-amrnb    amr格式编解码包
libx264    x264格式编解码包
libvorbis    ogg格式编解码包
libxvid    xvid格式编解码包

 

开始安装 (以下都在/usr/local/目录中操作)


1.faac
tar zxf faac-1.29.9.2.tar.gz

cd faac-1.29.9.2

./configure --prefix=/usr/local/
make && make install


注意: 如编译遇到以下错误

mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’

解决方法:

从123行开始修改此文件mpeg4ip.h,到129行结束。
修改前:
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif

修改后:
#ifdef __cplusplus
extern "C++" {
#endif
const char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif




2.lame
tar zxf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure --prefix=/usr/local/
make && make install

 


3.yasm(x264编译必需)
tar zxf yasm-1.2.0.tar.gz

cd yasm-1.2.0

./configure --prefix=/usr/local/
make && make install



4.x264
tar xjf x264-snapshot-20161028-2245-stable.tar.bz2

cd x264-snapshot-20161028-2245-stable/

./configure --prefix=/usr/local/ --enable-shared

make && make install


注意:如出现 ./configure 无权限,请执行

chmod +x ./configure

chmod +x ./config.guess

chmod +x ./config.sub

 


5.ogg
tar zxf  libogg-1.3.0.tar.gz

cd libogg-1.3.0
./configure --prefix=/usr/local/
make && make install

 


6.xvid
tar zxf xvidcore_1.3.2.orig.tar.gz 
cd xvidcore-1.3.2/build/generic/
./configure --prefix=/usr/local/
make && make install


7.ffmpeg
tar jxf ffmpeg-2.4.3.tar.bz2
cd ffmpeg-2.4.3
./configure --enable-libxvid --enable-libx264 --enable-libmp3lame  --enable-libfaac  --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-zlib --enable-bzlib
make && make install

 

安装成功后执行ffmpeg会打印版本信息

 

注:ffmpeg正常安装后执行ffmpeg时出现如下错误:

ffmpeg: error while loading shared libraries: libavdevice.so.53: cannot open shared object file: No such file or directory

解决办法:

vi /etc/ld.so.conf

加入:/usr/local/lib

执行ldconfig

 

 

 

上一篇:金蝶中间件V10如何部署JTopCMSV4 下一篇:Linux环境下安装图片处理库GraphicsMagick