Linux下 編譯 FFmpeg 支持 G711 + H264 寫入 mp4

最近需要將 window 動態庫移植到 linux 下,所以在linux下,編譯了一下 ffmpeg , 在此記錄下編譯過程,小夥伴們可以參考借鑑下。

               

 

 1. 編譯過程 

  1. freetype   https://download.savannah.gnu.org/releases/freetype/  2.9

    1.     ./configure --prefix=/usr/local/freetype

    2.     make -j8

    3.     make install

  2. xml2 http://xmlsoft.org/sources/  2.9.8

    1. ./configure  --without-python --prefix=/usr/local/libxml2

    2. make -j8

    3. make install

  3. fontconfig https://www.freedesktop.org/software/fontconfig/release/  2.13.92

    1. ./configure  --without-python --prefix=/usr/local/fontconfig

    2. make

    3. make install

  4. fribidi  https://github.com/fribidi/fribidi

    1. ./configure --prefix=/usr/local/fribidi

    2. make 

    3. make install

      • 'c2man' is missing on your system.

      • 解決: 修改 .travis.yml  before_script: - ./autogen.sh

  5. x264  http://download.videolan.org/pub/videolan/x264/snapshots/

    1. ./configure --enable-shared --enable-static --prefix=/usr/local/x264

    2. make

    3. make install

      • error: x264_bit_depth undeclared (first use in this function) did you mean x264_picture_t

      • 解決: ffmpeg libavcodec->libx264.c 替換 x264_bit_depth -> x264_BIT_DEPTH

  6. ffmpeg https://github.com/FFmpeg/FFmpeg 3.1.11

    •  PKG_CONFIG_PATH="/usr/lib/pkgconfig" ./configure --enable-static \
      
          --enable-shared \
      
          --enable-small \
      
          --enable-version3 \
      
          --enable-gpl \
      
          --enable-nonfree \
      
          --enable-libfreetype \
      
          --enable-libfontconfig \
      
          --enable-libfribidi \
      
          --enable-libx264 \
      
          --enable-decoder=h264 \
      
          --enable-encoder=libx264 \
      
          --enable-encoder=pcm_alaw --enable-decoder=pcm_alaw --enable-demuxer=mov --prefix=/usr/local/ffmpeg

       

    • make 

    • make install

 

 2. 注意事項 

  1.  將各個類庫下的pkg 拷貝到 /usr/lib/pkgconfig/   fontconfig not using in pkgconfig

          eg: cp  /usr/local/fontconfig/lib/fontconfig.pc  /usr/lib/pkgconfig/

     2.  error while loading shared libraries: libx264.so.148: cannot open shared object file: No such file or directory

         cp /usr/local/lib/libx264.so.148 /usr/lib/

 

 3. 結語 

        以上是從我這最強大腦中一點點回憶出來的,如果有不對的地方,大家樓下集合。

         

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章