ffmpeg 转码(mp4--h264)标准操作,直接按命令粘贴即可

需要软件:

X264:http://download.videolan.org/x264/snapshots/

ffmpeg:http://www.ffmpeg.org/download.html

yasm:http://yasm.tortall.net/Download.html

调试了近一下午时间,各种错误,以排查完成,并总结出一套盲操作手册,希望可以帮助大家


1. 解压缩并安装插件

tar -xvzf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure --prefix=/usr/local/yasm
make
make install


2.解压并安装nasm -----可忽略
xz -d nasm-2.13.03.tar.xz
tar -xvf nasm-2.13.03.tar
cd nasm-2.13.03
./configure --prefix=/usr/local/nasm --prefix=/usr/local/nasm
make
make install

3.解压并安装x264
tar -xjvf last_x264.tar.bz2
cd x264-snapshot-20180320-2245
./configure --prefix=/usr/local/x264 --enable-shared --enable-static --disable-asm
make
make install

2.解压缩并安装ffmpeg
tar -xjvf ffmpeg-3.4.2.tar.bz2
cd ffmpeg-3.4.2/
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/x264/include --extra-ldflags=-L/usr/local/x264/lib
make
make install
make clean && make install 重新编译

3.查看安装文件
cd /usr/local/ffmpeg/
有bin/include/lib/share

4.修改共享目录
vi /etc/ld.so.conf
加入内容:include ld.so.conf.d/*.conf
ldconfig
vi /etc/ld.so.conf.d/ffmpeg.conf
加入内容/usr/local/ffmpeg/lib
执行:ldconfig
配置生效

5.环境变量
vi /etc/profile

FFMPEG=/usr/local/ffmpeg
X264=/usr/local/x264
YASM=/usr/local/yasm
export FFMPEG X264 YASM
export PATH=$PATH:$FFMPEG/bin:$X264/bin:$YASM/bin
export LD_LIBRARY_PATH=$YASM/lib:$X264/lib:$FFMPEG/lib:$LD_LIBRARY_PATH
source /etc/profile

6.验证
ffmpeg -version

你可能感兴趣的:(技术运维)