<thead id="8fsr2"></thead>

    1. <var id="8fsr2"></var>
      <sub id="8fsr2"></sub>
      <var id="8fsr2"><output id="8fsr2"></output></var>

      <var id="8fsr2"><output id="8fsr2"><form id="8fsr2"></form></output></var><var id="8fsr2"><output id="8fsr2"><form id="8fsr2"></form></output></var>
        <thead id="8fsr2"><ruby id="8fsr2"></ruby></thead>

      常見問題frequently questions

      當前位置:首頁 > 網站常識 > CentOS安裝ffmpeg并轉碼視頻為mp4
      常見問題frequently questions 網站常識Common Sense 推廣知識Popularizing knowledge 空間知識Spatial knowledge 備案問題Filing problems

      CentOS安裝ffmpeg并轉碼視頻為mp4

      作者:萍鄉市基三易速科技有限公司   時間:2021-09-18   瀏覽量:881

      前言

      現需要將一批avi格式的視頻轉碼為mp4,以下為操作步驟。系統版本為CentOS 7。

      如果不安裝x264,轉碼后只有聲音,沒有視頻。

      編譯安裝nasm

      wget https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.xz
      tar xf nasm-2.15.05.tar.xz
      cd nasm-2.15.05
      ./configure --prefix=/usr/local/nasm/
      make
      make install
      # 自行配置PATH環境變量
      

      編譯安裝libfdk-aac

      wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.1.tar.gz
      tar zxvf fdk-aac-2.0.1.tar.gz
      cd fdk-aac-2.0.1
      ./configure --disable-static
      make
      make install
      

      編譯安裝x264

      git clone https://code.videolan.org/videolan/x264.git
      cd x264
      ./configure --prefix=/usr/local/x264/ --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
      make
      make install
      # 自行配置PATH環境變量
      

      安裝yum依賴

      yum install -y openssl gnutls gnutls-devel lame lame-devel faac faac-devel
      

      安裝ffmpeg

      wget http://ffmpeg.org/releases/ffmpeg-4.4.tar.xz
      ## 解壓后cd
      ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-pthreads --enable-shared --enable-libmp3lame --enable-libx264 --enable-pic --enable-libfdk-aac --enable-openssl --enable-nonfree
      make
      make install
      # 自行配置PATH環境變量
      

      問題記錄

      缺少庫函數

      ffmpeg: error while loading shared libraries: libavdevice.so.58
      #
      ffmpeg: error while loading shared libraries: libfdk-aac.so.2
      

      解決方法:

      1. 編輯/etc/ld.so.conf
      2. 追加內容:/usr/local/ffmpeg/lib//usr/local/lib/
      3. 完整內容示例如下:
      include ld.so.conf.d/*.conf
      /usr/local/ffmpeg/lib/
      /usr/local/lib/
      

      avi轉mp4

      ffmpeg -i test.avi -vcodec h264 -f mp4 test.mp4
      # 限制線程數(不限制可能會吃滿CPU)
      ffmpeg -i test.avi -vcodec h264 -threads 2 -f mp4 test.mp4
      
      国产无码AV在线_国产精彩刺激真实乱对白在线播放_日本在线不卡中文字幕资源_国产小屁孩cao大人在线播放