最近需要将 window 动态库移植到 linux 下,所以在linux下,编译了一下 ffmpeg , 在此记录下编译过程,小伙伴们可以参考借鉴下。
1. 编译过程
-
freetype https://download.savannah.gnu.org/releases/freetype/ 2.9
-
./configure --prefix=/usr/local/freetype
-
make -j8
-
make install
-
-
xml2 http://xmlsoft.org/sources/ 2.9.8
-
./configure --without-python --prefix=/usr/local/libxml2
-
make -j8
-
make install
-
-
fontconfig https://www.freedesktop.org/software/fontconfig/release/ 2.13.92
-
./configure --without-python --prefix=/usr/local/fontconfig
-
make
-
make install
-
-
fribidi https://github.com/fribidi/fribidi
-
./configure --prefix=/usr/local/fribidi
-
make
-
make install
-
'c2man' is missing on your system.
-
解决: 修改 .travis.yml before_script: - ./autogen.sh
-
-
-
x264 http://download.videolan.org/pub/videolan/x264/snapshots/
-
./configure --enable-shared --enable-static --prefix=/usr/local/x264
-
make
-
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
-
-
-
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. 注意事项
- 将各个类库下的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. 结语
以上是从我这最强大脑中一点点回忆出来的,如果有不对的地方,大家楼下集合。