centos7 安裝ffmpeg(轉(zhuǎn)webm格式用)

一、安裝環(huán)境

[root@centos]# yum install gcc

二、安裝yasm

  1. 下載源碼:
    [root@centos]# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
    
  2. 編譯配置:
    [root@centos]# ./configure --prefix=/usr/local/yasm
    
  3. 編譯安裝:
    [root@centos]# make
    [root@centos]# make install
    
  4. 環(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)

  1. 下載源碼:

    [root@centos]# wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.0.tar.bz2
    
  2. 編譯配置:

    經(jīng)過(guò)多次試驗(yàn),此項(xiàng)安裝不建議配置安裝路徑選項(xiàng),可能是需要配置什么環(huán)境,一直沒搞定。

    [root@centos]# ./configure  --enable-shared 
    
  3. 編譯與安裝:

    [root@centos]# make
    [root@centos]# make install
    
  4. 配置動(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
    
  5. 測(cè)試命令:

    [root@centos]# vpxdec
    

四、安裝libogg

  1. 下載源碼:
    [root@centos]# http://xiph.org/downloads/
    
  2. 編譯配置:
    [root@centos]# ./configure   # 默認(rèn)配置即可
    
  3. 編譯安裝:
    [root@centos]# make 
    [root@centos]# make install
    

五、安裝libvorbis

  1. 下載源碼:
    [root@centos]# http://xiph.org/downloads/
    
  2. 編譯配置:
    [root@centos]# ./configure   (默認(rèn)配置即可)
    
  3. 編譯安裝:
    [root@centos]# make 
    [root@centos]# make install
    
  4. 依賴項(xiàng):
    • libogg

六、安裝ffmpeg

(官方參考文檔:https://trac.ffmpeg.org/wiki/CompilationGuide/Centos)

  1. 下載源碼:

    
    [root@centos]# git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg 
    
    

    沒有g(shù)it環(huán)境,可以下載zip包:https://github.com/FFmpeg/FFmpeg

  2. 編譯配置:

    # 預(yù)使用vp9,必須添加libvorbis和libvpx
    [root@centos]# ./configure --prefix=/usr/local/ffmpeg   --disable-ffserver --enable-libvorbis --enable-libvpx  --enable-shared
    
  3. 編譯:

    [root@centos]# make
    
  4. 安裝:

    #root執(zhí)行
    [root@centos]# make install 
    
  5. 環(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 
    
  6. 動(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
    
  7. 依賴項(xiàng):

    • yasm

    • libvpx

    • libvorbis

  8. 測(cè)試命令:

    [root@centos]# ffmpeg -i /tmp/111.mp4 -c:v libvpx-vp9 -crf 50 -b:v 0 -c:a libvorbis /tmp/output2.webm
    
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容