ffmpeg部署
ffmpeg部署
一、下载ffmpeg和依赖
1.1 ffmpeg
wget https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz1.2 yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz 二、安装依赖和yasm
yum install -y gcc
#安装GCC
tar zxf yasm-1.3.0.tar.gz
#解压缩
cd yasm-1.3.0/
进入yasm目录
./configure
#预编译
make
#编译
make install
#安装四、安装ffmpeg
4.1 ffmpeg使用xz压缩
xz -d ffmpeg-4.1.tar.xz
#先将xz格式转换为tar格式
tar -xf ffmpeg-4.1.tar
#解压缩tar格式- 2 安装
./configure --prefix=/usr/local/ffmpeg
#预编译,指定安装,目录
make & make install
#编译并安装4.3 配置环境变量
cat << EOF >> /etc/profile
#ffmpeg
export FFMEPG=/usr/local/ffmpeg
export PATH=\${FFMEPG}/bin:\${PATH}
EOF
source /etc/profile4.3 配置动态链接库
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/五、查看ffmpeg版本
ffmpeg -version打印输出
[root@localhost]# ffmpeg -version
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
configuration: --prefix=/usr/local/ffmpeg
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100六、安装x264插件
6.1 安装依赖nasm
下载:
https://www.nasm.us/pub/nasm/releasebuilds/2.15rc12/
wget https://www.nasm.us/pub/nasm/releasebuilds/2.15rc12/nasm-2.15rc12.tar.gz安装
tar -zxf nasm-2.15rc12.tar.gz
cd nasm-2.15rc12
./configure --prefix=/uar/local/nasm
make && make install添加环境变量
cat << EOF >> /etc/profile
#ffmpeg-nasm
export PATH=/uar/local/nasm/bin:$PATH
EOF
source /etc/profile6.2 下载x264
http://www.videolan.org/developers/x264.html
wget https://code.videolan.org/videolan/x264/-/archive/master/x264-master.tar.bz2解压缩
yum insatll -y bzip2
#安装bzip2解压
tar -jxf x264-master.tar.bz2
#解压安装包安装
cd x264-master
./configure --prefix=/usr/local/x264 --enable-shared
make
make install配置环境变量
cat << EOF >> /etc/profile
#ffmpeg-H264
export PKG_CONFIG_PATH=/usr/local/x264/lib/pkgconfig
EOF
source /etc/profile配置动态链接库
cat << EOF >> /etc/ld.so.conf
/usr/local/x264/lib/
EOF
ldconfig -p重新编译ffmpeg
./configure --prefix=/usr/local/ffmpeg --enable-libx264 --enable-gpl七、参考文献
https://my.oschina.net/u/4262150/blog/4282928?hmsr=kaifa_aladdin