centos7下安装ffmpeg

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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sunxiaopengsun

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值