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. 结语 

        以上是从我这最强大脑中一点点回忆出来的,如果有不对的地方,大家楼下集合。

         

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