当前位置: > CentOS > CentOS教程 >

centos7下安装ffmpeg

时间:2017-06-10 11:59来源:linux.it.net.cn 作者:IT

1.安装ffmpeg

1.获取依赖包

可以按照以下网址联网下载最新版本或者使用安装包里面的软件

yasm
wget http://www.tortall.NET/projects/yasm/releases/yasm-1.3.0.tar.gz

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

fdk-acc
wget http://sourceforge.net/projects/opencore-amr/files/fdk-aac/

ame
wget http://ufpr.dl.sourceforge.Net/project/lame/lame/3.99/lame-3.99.5.tar.gz

opus
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz

ogg
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz

vorbis
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz

libvpx
wget Git clone https://github.com/webmproject/libvpx.git

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

libtheora
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz

 

2.安装依赖包

Yasm

tar zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure --prefix=/usr/local/cellar/ffmpeg_build --bindir=/usr/bin

make && make install

 

x264

tar axf last_x264.tar.bz2

cd last_x264

./configure \

--prefix=/usr/local/cellar/ffmpeg_build \

--bindir=/usr/bin \

--enable-shared

make && make install

 

fdk-acc

tar zxvf fdk-aac-0.1.4.tar.gz

cd fdk-aac-0.1.4

autoreconf -fiv

./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-shared

make && make install

 

Lame

tar zxvf lame-3.99.5.tar.gz

cd tar zxvf lame-3.99.5

./configure --prefix=/usr/local/cellar/ffmpeg_build --bindir=/usr/bin --disable-shared --enable-nasm

make && make install

 

Opus

tar zxvf opus-1.1.tar.gz

cd opus-1.1

autoreconf -fiv

./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-shared

make && make install

 

ogg

tar zxvf libogg-1.3.2.tar.gz

cd tar zxvf libogg-1.3.2

./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-shared

make && make install

 

vorbis

tar zxvf libvorbis-1.3.5.tar.gz

cd libvorbis-1.3.5

./configure --prefix=/usr/local/cellar/ffmpeg_build --with-ogg=/usr/local/cellar/ffmpeg_build --disable-shared

make && make install

 

Libvpx

cd libvpx

./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-examples

make && make install

 

Xvidcore

tar zxvf xvidcore-1.3.4.tar.gz

cd xvidcore/build/generic/

./configure --prefix=/usr/local/cellar/ffmpeg_build

make && make install

 

Libtheora

tar zxvf libtheora-1.1.1.tar.gz

cd libtheora-1.1.1

./configure --prefix=/usr/local/cellar/ffmpeg_build --with-ogg=/usr/local/cellar/ffmpeg_build --disable-examples --disable-shared --disable-sdltest --disable-vorbistest

make && make install

 

Freetype

tar zxvf freetype-2.3.5.tar.gz 

cd  freetype-2.3.5

./configure --prefix=/usr/local/cellar/ffmpeg_build

make && make install

 

3.安装ffmpeg

tar axf ffmpeg-2.7.2.tar.bz2

cd ffmpeg-2.7.2

export PKG_CONFIG_PATH=/usr/local/cellar/ffmpeg_build/lib/pkgconfig

 

 

CFLAGS="-fPIC -m64" ./configure \
--prefix=/usr/local/cellar/ffmpeg \
--extra-cflags="-I/usr/local/cellar/ffmpeg_build/include" \
--extra-ldflags="-L/usr/local/cellar/ffmpeg_build/lib" \
--extra-libs=-ldl \
--bindir=/usr/bin \
--enable-version3 \
--enable-zlib \
--enable-bzlib \
--enable-pic \
--enable-gpl \
--enable-nonfree \
--enable-pthreads \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264

 

 

此处出现问题,请访问http://rickie622.blog.163.com/blog/static/212388112014113125836773/尝试解决

确认Makefile中指定的config.mak(在ffmpeg根目录下)中:CONFIG_FFPLAY=yes,用来生成ffplay

 

make && make install

 

4.验证是否安装成功

ffmpeg -version

 

 

如果报如下类似错误

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

解决办法是:

 vi /etc/ld.so.conf

将 /usr/local/cellar/ffmpeg_build/lib 加到ld.so.conf文件末尾

然后执行命令:

Ldconfig

 

5.编译ffmpeg

 

1.out:

g++ testCode.cc -o main.out -L"/usr/local/cellar/ffmpeg/lib" -L"/usr/local/cellar/ffmpeg_build/lib" -I"/usr/local/cellar/ffmpeg/include" -I"/usr/local/cellar/ffmpeg_build/include"  -lavformat -lavdevice -lavcodec -lavutil -lavfilter -lpostproc -lswresample -lswscale  -lSDL -lxvidcore -lx264 -lpthread -ltheora -ltheoraenc -ltheoradec -lvorbis -lvorbisenc -lvpx -lopus -logg -lmp3lame -lfdk-aac -lm  -lz -lpthread -lrt

 

1.问题:ffmpeg: 'UINT64_C' was not declared in this scope

http://blog.csdn.net/beitiandijun/article/details/19156175

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容