You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.5 KiB
51 lines
1.5 KiB
#!/bin/bash
|
|
|
|
yum install gcc bzip2 -y
|
|
|
|
cd /usr/local
|
|
mkdir software
|
|
cd software
|
|
|
|
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
|
|
wget https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/ffmpeg/yasm-1.3.0.tar.gz
|
|
tar zxvf yasm-1.3.0.tar.gz
|
|
cd yasm-1.3.0
|
|
./configure
|
|
make && make install
|
|
|
|
# https://www.videolan.org/developers/x264.html
|
|
# 编译H264库
|
|
cd /usr/local/software
|
|
wget https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/ffmpeg/x264-master.tar.bz2
|
|
|
|
tar -xjf x264-master.tar.bz2
|
|
cd x264-master/
|
|
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
|
|
make
|
|
make install
|
|
|
|
# 编译 ffmpeg
|
|
#wget http://www.ffmpeg.org/releases/ffmpeg-4.3.tar.xz
|
|
wget https://dsideal.obs.cn-north-1.myhuaweicloud.com/HuangHai/ffmpeg/ffmpeg-4.3.tar.xz
|
|
tar xvJf ffmpeg-4.3.tar.xz
|
|
|
|
cd /usr/local/software/ffmpeg-4.3
|
|
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-yasm --enable-libx264 --enable-gpl
|
|
--enable-pthreads --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib
|
|
make -j4 && make install
|
|
|
|
#配置环境变量
|
|
echo "/usr/local/x264/lib/" >> /etc/ld.so.conf.d/x264.conf
|
|
echo "include ld.so.conf.d/*.conf" >> /etc/ld.so.conf
|
|
echo "/usr/local/ffmpeg/lib/" >> /etc/ld.so.conf
|
|
ldconfig
|
|
echo "PATH=$PATH:/usr/local/ffmpeg/bin" >> /etc/profile
|
|
echo "export PATH" >> /etc/profile
|
|
source /etc/profile
|
|
echo "/usr/local/x264/lib/" >> /etc/ld.so.conf.d/x264.conf
|
|
|
|
# 验证安装成果
|
|
ffmpeg -version
|
|
|
|
# 查看是否有264编码器
|
|
ffmpeg -encoders |grep 264 |