2 要安装x264模块首先要先装nasm
3 安装脚本如下【复制即可使用】
#!/bin/bash
yum -y install epel-release && yum -y install git wget #下载git,wget
echo $?
if [ $? == 0 ];then #判断工具安装情况
wget http://www.nasm.us/pub/nasm/releasebuilds/2.13/nasm-2.13.tar.gz #下载安装包nasm
git clone git://git.videolan.org/x264.git #下载x264模块
wget http://219.238.7.67/files/208800000B606D7E/ffmpeg.org/releases/ffmpeg-3.4.2.tar.bz2 #下载ffmpeg
else
exit #如果工具下载失败,直接退出
fi
tar xvf nasm-2.13.tar.gz #安装nasm
cd nasm-2.13/ && mkdir /product/{ffmpeg,x264,nasm2-13} -p
./configure --prefix=/product/nasm2-13
echo $?
if [ $? == 0 ];then
make && make install
echo $?
if [ $? == 0 ];then
echo "nasm success" >/media/1.txt
else
exit
fi
fi
cd ../x264/ #安装x264
ln -s /product/nasm2-13/bin/nasm /usr/bin/nasm
./configure --enable-shared --enable-static --prefix=/product/x264
echo $?
if [ $? == 0 ];then
make && make install
echo $?
if [ $? == 0 ];then
echo "x264 success" >> /media/1.txt
else
exit
fi
fi
cd ..
tar xvf ffmpeg-3.4.2.tar.bz2 #安装ffmpeg
cd ffmpeg-3.4.2/
./configure --prefix=/product/ffmpeg/ --enable-shared --disable-ffserver --disable-ffplay --enable-postproc --enable-gpl --enable-libx264 --disable-asm --extra-cflags=-I/product/x264/include --extra-ldflags=-L/product/x264/lib
echo $?
if [ $? == 0 ];then
make && make install
echo $?
if [ $? == 0 ];then
echo "ffmpeg success" >/media/1.txt
else
exit
fi
fi
ln -s /product/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg #做链接,写入/etc/ld.so.conf
sed -i '$a/product/x264/bin/' /etc/ld.so.conf
sed -i '$a/product/x264/lib' /etc/ld.so.conf
sed -i '$a/product/x264/include/' /etc/ld.so.conf
ln -s /product/x264/bin/x264 /usr/bin/x264
sed -i '$a/product/ffmpeg/lib/' /etc/ld.so.conf
sed -i '$a/product/ffmpeg/include/' /etc/ld.so.conf
ldconfig
以上脚本,复制即可使用
原文地址:http://blog.51cto.com/13272050/2084592