ffmpeg安装 centos7

本文详细介绍了在Linux环境下安装FFmpeg所需的依赖库及编译过程,包括yasm、lame、opencore-amr的安装,以及FFmpeg的配置、编译和安装步骤,最后解决了lib64下软连接问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、安装依赖

yasm安装

#ffmpeg编译中为了提高编译速度,使用了汇编指令,于是需要使用这个工具。
yum -y install yasm

也可以通过源码包安装
tar -zxf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install

lame安装

tar -zxf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install

opencore-amr安装

tar -zxf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure
make
make install

二、安装ffmpeg

cd /usr/local/src
wget http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2
tar -jxf http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2
cd ffmpeg-3.2.4

# 其中–enable-shared表示生成动态链接库,可以供以后编程使用,同时生成的可执行程序也依赖这些动态库。如果不加上–enable-shared选项则使用静态链接的方式编译,此时不会生成动态库,同时生成的ffmpeg等的可执行文件也比较大,但他们不需要动态库就可以直接运行
./configure --enable-version3 --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared --prefix=/usr/local/ffmpeg
make
make install


echo "/usr/local/ffmpeg/lib" > /etc/ld.so.conf.d/ffmpeg.conf
ldconfig
ln -sf /usr/local/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg

ffmpeg     # 出现下述则表示安装成功
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
  configuration: --enable-version3 --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared --prefix=/usr/local/ffmpeg
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

三、为lib64创建软连接

ffmpeg: error while loading shared libraries: libopencore-amrnb.so.0: cannot open shared object file: No such file or directory

ffmpeg安装后如果出现如上错误提示

则建立对应的软链接即可,先查找文件位置,如:find / -name libavdevice.so.56

ln -s /usr/local/lib/libavdevice.so.56 /usr/lib64/libavdevice.so.56
ln -s /usr/local/lib/libavfilter.so.5 /usr/lib64/libavfilter.so.5
ln -s /usr/local/lib/libavformat.so.56 /usr/lib64/libavformat.so.56
ln -s /usr/local/lib/libavcodec.so.56 /usr/lib64/libavcodec.so.56
ln -s /usr/local/lib/libswresample.so.1 /usr/lib64/libswresample.so.1
ln -s /usr/local/lib/libswscale.so.3 /usr/lib64/libswscale.so.3
ln -s /usr/local/lib/libavutil.so.54 /usr/lib64/libavutil.so.54
ln -s /usr/local/lib/libopencore-amrwb.so.0 /usr/lib64/libopencore-amrwb.so.0
ln -s /usr/local/lib/libopencore-amrnb.so.0 /usr/lib64/libopencore-amrnb.so.0
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib64/libmp3lame.so.0

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值