centos5.6安装ffmpeg

原创
2017/02/18 11:34
阅读数 955

一、安装编码和依赖库文件

[root@kxtest2 ffmpeg]# yum -y install lame lame-devel libogg libogg-devel dirac dirac-devel libvorbis libvorbis-devel SDL SDL-devel gsm gsm-devel libvpx libvpx-devel libvpxlame-devel xvidcore xvidcore-devel faac faac-devel opencore-amr opencore-amr-devel yasm faad2 a52dec

 

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: centos.ustc.edu.cn

* extras: mirrors.163.com

* updates: mirrors.163.com

Setting up Install Process

No package lame available.

No package lame-devel available.

No package dirac available.

No package dirac-devel available.

No package gsm available.

No package gsm-devel available.

No package libvpx available.

No package libvpx-devel available.

No package libvpxlame-devel available.

No package xvidcore available.

No package xvidcore-devel available.

No package faac available.

No package faac-devel available.

No package opencore-amr available.

No package opencore-amr-devel available.

No package yasm available.

No package faad2 available.

No package a52dec available.

Resolving Dependencies

--> Running transaction check

……

 

Complete!

 

 

二、安装LAME

wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz

./configure --prefix=/usr --enable-shared,make,make install

 

三、安装DIRAC

http://pkgs.org/centos-5-rhel-5/epel-x86_64/dirac-devel-1.0.0-2.el5.x86_64.rpm.html

下载相关包并安装

rpm -Uvh dirac*.rpm

 

四、安装libgsm

下载gsm-1.0.12.tar.gz

wget http://osxwinebuilder.googlecode.com/files/gsm-1.0.13.tar.gz

 

http://download.pudn.com/downloads80/sourcecode/unix_linux/network/74126570gsm-1.0.12.tar.gz

 

解压 tar zxf gsm-1.0.12.tar.gz

编译安装  make

编译到后面会出错,但库已生成,用命令拷贝即可

cp lib/libgsm.a /usr/lib/

cp inc/gsm.h /usr/include/gsm/

ffmpeg编译参数: -enable-libgsm

 

五、安装opencore-amr

wget ftp://137.189.4.14/pub/FreeBSD/ports/distfiles/opencore-amr-0.1.2.tar.gz

./configure --prefix=/usr --enable-shared、make、make install

 

六、安装libtheora

tar jxf libtheora-1.1.1.tar.bz2

cd libtheora-1.1.1

./configure --prefix=/usr --with-ogg=/usr --with-vorbis=/usr --with-sdl-prefix=/usr

make

make install

 

七、安装yasm

编译x264时候需要

http://www.tortall.net/projects/yasm/

下载:http://www.tortall.net/projects/yasm/releases/yasm-0.8.0.tar.gz

解压,编译安装:

./configure –prefix=/mingw
make
make install

 

八、安装x264

wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2

tar jxf last_x264.tar.bz2

cd x264-snapshot-20110822-2245

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

make

make install

九、安装ffmpeg

wget http://ffmpeg.org/releases/ffmpeg-0.8.2.tar.gz

tar zxf ffmpeg-0.8.2.tar.gz

tar zxf ffmpeg-0.8.2.tar.gz

./configure --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --disable-indev=v4l --disable-indev=v4l2 --extra-cflags='-O2 -g -pipe -m64 -fPIC' --enable-avfilter --enable-libdirac --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab

make

make install

 

 

需注意1:

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

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

解决办法:

vi /etc/ld.so.conf

加入:/usr/local/lib

执行# ldconfig -v

这样就可以解决

 

需注意2:

64位系统编译各个软件包和32位大同小异,32位的安装步骤参加:http://hi.baidu.com/zeeler/blog/item/36ed97dc2b093e51cdbf1a18.html
这里我只说一下64位环境下需要修改的个别地方:
1. libgsm的修改:
# 64bit环境Makefile内容要做修改。
vi Makefile
CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) $(WAV49) $(CCINC) -I$(INC) -fPIC
# 上面一行要CCFLAGS下面追加
2. libnut的修改:
vi config.mak
CFLAGS += -fPIC 这行加在适当位置。
3. ffmpeg编译前:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CFLAGS="-fPIC -m64"

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部