最近需要將 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. 結語
以上是從我這最強大腦中一點點回憶出來的,如果有不對的地方,大家樓下集合。