ffmpeg 轉碼(mp4--h264)標準操作,直接按命令貼上即可
阿新 • • 發佈:2019-02-04
需要軟體:
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.gzcd 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