一、安裝環(huán)境
[root@centos]# yum install gcc
二、安裝yasm
- 下載源碼:
[root@centos]# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz - 編譯配置:
[root@centos]# ./configure --prefix=/usr/local/yasm - 編譯安裝:
[root@centos]# make [root@centos]# make install - 環(huán)境變量配置:
[root@centos]# vim /etc/profile # 追加: export PATH=/usr/local/yasm/bin:$PATH # 使配置生效 [root@centos]# source /etc/profile
三、安裝libvpx
(文檔:http://www.linuxfromscratch.org/blfs/view/svn/multimedia/libvpx.html)
-
下載源碼:
[root@centos]# wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.0.tar.bz2 -
編譯配置:
經(jīng)過(guò)多次試驗(yàn),此項(xiàng)安裝不建議配置安裝路徑選項(xiàng),可能是需要配置什么環(huán)境,一直沒搞定。
[root@centos]# ./configure --enable-shared -
編譯與安裝:
[root@centos]# make [root@centos]# make install -
配置動(dòng)態(tài)鏈接庫(kù):
默認(rèn)的安裝位置應(yīng)該是:/usr/local 需要將/usr/local/lib 路徑添加到動(dòng)態(tài)鏈接庫(kù)
[root@centos]# echo /usr/local/lib >> /etc/ld.so.conf; [root@centos]# ldconfig -
測(cè)試命令:
[root@centos]# vpxdec
四、安裝libogg
- 下載源碼:
[root@centos]# http://xiph.org/downloads/ - 編譯配置:
[root@centos]# ./configure # 默認(rèn)配置即可 - 編譯安裝:
[root@centos]# make [root@centos]# make install
五、安裝libvorbis
- 下載源碼:
[root@centos]# http://xiph.org/downloads/ - 編譯配置:
[root@centos]# ./configure (默認(rèn)配置即可) - 編譯安裝:
[root@centos]# make [root@centos]# make install - 依賴項(xiàng):
- libogg
六、安裝ffmpeg
(官方參考文檔:https://trac.ffmpeg.org/wiki/CompilationGuide/Centos)
-
下載源碼:
[root@centos]# git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg沒有g(shù)it環(huán)境,可以下載zip包:https://github.com/FFmpeg/FFmpeg
-
編譯配置:
# 預(yù)使用vp9,必須添加libvorbis和libvpx [root@centos]# ./configure --prefix=/usr/local/ffmpeg --disable-ffserver --enable-libvorbis --enable-libvpx --enable-shared -
編譯:
[root@centos]# make -
安裝:
#root執(zhí)行 [root@centos]# make install -
環(huán)境變量配置:
配置profile文件(以下默認(rèn)使用vim編輯器):
#打開環(huán)境變量配置文件 [root@centos]# vim /etc/profile #在文件末尾加上兩行: export FFMPEG_HOME=/usr/local/ffmpeg export PATH=$FFMPEG_HOME/bin:$PATH #使配置生效 [root@centos]# source /etc/profile -
動(dòng)態(tài)鏈接庫(kù)配置:
配置ld.so.conf文件(以下操作使用vim編輯器):
# 動(dòng)態(tài)鏈接庫(kù)配置 [root@centos]# vim /etc/ld.so.conf # 追加 # 將ffmpeg的lib路徑添加到動(dòng)態(tài)連接搜索選項(xiàng) /usr/local/ffmpeg/lib # 將配置更新到ld.so.cache,從而使配置生效 [root@centos]# ldconfig或
[root@centos]# echo /usr/local/ffmpeg/lib >> /etc/ld.so.conf; [root@centos]# ldconfig -
依賴項(xiàng):
yasm
libvpx
libvorbis
-
測(cè)試命令:
[root@centos]# ffmpeg -i /tmp/111.mp4 -c:v libvpx-vp9 -crf 50 -b:v 0 -c:a libvorbis /tmp/output2.webm