凡是用到视频音频的地方,都用到ffmpeg。很多时候我们需要用到另外一些依赖库,来实现一些别的功能,比如使用libfreetype库在视频顶部的指定文件中绘制文本字符串或文本。这里是记录一下FFmpeg所有的依赖库编译。
- 准备工作
apt update
apt install gcc make cmake
apt install autoconf subversion git wget g++ pkg-config
# libtool libtool libogg-devel nasm
apt install autopoint
- 下载编译libtool
Libtool-2.4.6百度云地址:https://pan.baidu.com/s/1lPbzZ5ltdn-3M5BJRRTcMQ 提取码:2egh
tar -zxvf libtool-2.4.6.tar.gz
cd libtool-2.4.6
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译OpenAL Soft
OpenAL Soft-1.21.1百度云地址:https://pan.baidu.com/s/1007zuLbNcTGWNpv5HUdGhQ 提取码:kkj9
tar -zxvf openal-soft-1.20.1.tar.bz2
cd openal-soft-1.20.1/
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
rm -rf build
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=${BUILD_LIBS} ..
make
make install
- 下载编译openh264
OpenH264-2.1.1百度云地址:https://pan.baidu.com/s/1wxLn0P4XSsGS_g2V5vH8_A 提取码:i6fn
tar -zxvf openh264-2.1.1.tar.gz
cd openh264-2.1.1
BUILD_LIBS=${HOME}/telecom/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
make ENABLE64BIT=Yes
# make DESTDIR=${BUILD_LIBS} install
make install DESTDIR=${BUILD_LIBS} LIBDIR_NAME=lib PREFIX=
# cp include/* ${BUILD_LIBS}/include
# cp ./lib* ${BUILD_LIBS}/lib
- 下载编译x264
libx264(稳定版)百度云地址:https://pan.baidu.com/s/1uuCbxHQjt82V7_mM3uiRDQ 提取码:r5gp
tar -zxvf x264-stable.tar.gz
cd x264-stable
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
# 运行之后无法编译
#./autogen.sh
./configure --prefix=${BUILD_LIBS} --enable-shared --enable-pic
make
make install
- 下载编译x265
libx265(稳定版)百度云地址:https://pan.baidu.com/s/1mUW0SbIRWo0YtDu8uxSq5A 提取码:m040
tar -zxvf x265-stable.tar.gz
cd x265-stable
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
cd build/linux
make clean
sh make-Makefiles.bash
make
make install
# cp x265*.h ${BUILD_LIBS}/include
# cp libx265* ${BUILD_LIBS}/lib
- 下载编译iLBC
iLBC百度云地址:https://pan.baidu.com/s/1LzqunIsb7CE8PBcShuY3GQ 提取码:6j53
tar -zxvf libiLBC.tar.gz
cd libiLBC
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
./autogen.sh
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译g729
g729百度云地址:https://pan.baidu.com/s/1GM7iwgeggAk0h7vTmyPkwA 提取码:3bxq
tar -zxvf g729.tar.gz
cd g729
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
# aclocal -I ${BUILD_LIBS}/share/aclocal1.10 -I ${BUILD_LIBS}/libtool/m4 --install
automake --add-missing
./autogen.sh
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译libgsm
gsm-1.0.19百度云地址:https://pan.baidu.com/s/1uT_z4hcRg_hcvKqGUCt2sQ 提取码:cji6
tar -zxvf gsm-1.0.18.tar.gz
cd gsm-1.0-pl18/
修改Makefile文件,在make的时候加参数应该也可以,试了一下效果不佳。于是修改了Makefile:
CC = gcc -ansi -pedantic -fPIC -shared
CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
$(WAV49) $(CCINC) -I$(INC) -fpic
BUILD_LIBS=${HOME}/telecom/build_libs
# 指定DESTDIR无效。
make
make install
cp -rf ./inc/* ${BUILD_LIBS}/include
cp -rf ./lib/* ${BUILD_LIBS}/lib
- 下载编译opencore-amr
opencore-amr-0.1.5百度云地址:https://pan.baidu.com/s/10PSbp7tG5JmJmXSjJrYeQQ 提取码:xg9j
tar -zxvf opencore-amr-0.1.5.tar.gz
cd opencore-amr-0.1.5/
BUILD_LIBS=${HOME}/build_libs
autoreconf --install
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译vo-amrwbenc
vo-amrwbenc-0.1.3百度云地址:https://pan.baidu.com/s/1-010td6RLwmwuf49ShvmXQ 提取码:51w3
tar -zxvf vo-amrwbenc-0.1.3.tar.gz
cd vo-amrwbenc-0.1.3/
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译libopus
opus-1.3.1百度云地址:https://pan.baidu.com/s/1Av-6qEm_Y7sTYpn__EO6pA 提取码:7s6r
tar -zxvf opus-1.3.1.tar.gz
cd opus-1.3.1
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS} --with-pic --enable-float-approx
make
make install
- 下载编译libyuv
libyuv百度云地址:https://pan.baidu.com/s/17Trin4-cZVM38EOCDkvIYg 提取码:gdfz
tar -zxvf libyuv-master.tar.gz
cd libyuv-master
make -f linux.mk
# V=1 -r libyuv BUILDTYPE=Release
- 下载编译libvpx
libvpx-1.9.0百度云地址:https://pan.baidu.com/s/1FqlnEbmoFmhtNXqTDdkXrA 提取码:s8pb
tar -zcvf libvpx-1.8.2.tar.gz
cd libvpx-1.8.2
./configure \
--enable-realtime-only \
--enable-error-concealment \
--disable-examples \
--enable-vp8 --enable-pic \
--enable-shared --as=yasm
make
make install
- 下载编译Which
which-2.21百度云地址:https://pan.baidu.com/s/1DgBU3PDuknoujkARmww7Fg 提取码:vb90
tar -zxvf which-2.21.tar.gz
cd which-2.21
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译YASM
YASM百度云地址:https://pan.baidu.com/s/1_ZCIOaMy4Ae0pflawvsjIg 提取码:67bt
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- (字体相关)下载编译libfreetype
freetype-2.10.4百度云地址:https://pan.baidu.com/s/1y5oMs69IoXGBrLEJKRzS5Q 提取码:nxuw
tar -zxvf freetype-2.10.4.tar.gz
cd freetype-2.10.4
BUILD_LIBS=${HOME}/build_libs
# 注意不要运行 autogen.sh
./configure --prefix=${BUILD_LIBS}
make
make install
- (字体相关)下载编译FriBidi
fribidi-1.0.8百度云地址:https://pan.baidu.com/s/1ASdH5SUj-Kbr9ULrtiEshw 提取码:07ue
tar -zxvf fribidi-1.0.8.tar.bz2
cd fribidi-1.0.8/
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
if [ -f autogen.sh ]; then
./autogen.sh
fi
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
- (字体相关)下载编译libxml2
libxml2-2.7.1百度云地址:https://pan.baidu.com/s/1ZIwwqFWOqqSXD5o1u40Pwg 提取码:3v00
tar -zxvf libxml2-2.7.1.tar.gz
cd libxml2-2.7.1
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
if [ -f autogen.sh ]; then
./autogen.sh
fi
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib" \
--without-python
make
make install
- (字体相关)下载编译gperf
gperf-3.1百度云地址:https://pan.baidu.com/s/1bwJJSS7Wujiw5-kJADl1Bg 提取码:l9de
tar -zxvf gperf-3.1.tar.gz
cd gperf-3.1
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
if [ -f autogen.sh ]; then
./autogen.sh
fi
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
cp src/gperf ${BUILD_LIBS}/bin
- (字体相关)下载编译fontconfig
fontconfig-2.13.93百度云地址:https://pan.baidu.com/s/1UvYID1xHKqNF0HqayDy6OQ 提取码:l4xp
tar -zxvf fontconfig-2.13.93.tar.xz
cd fontconfig-2.13.93
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig
if [ -f autogen.sh ]; then
./autogen.sh
fi
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include -I${BUILD_LIBS}/include/freetype2" \
LDFLAGS="-L${BUILD_LIBS}/lib" \
--enable-shared --enable-libxml2
make
make install
- (字体相关)下载libass
libass-0.14.0百度云地址:https://pan.baidu.com/s/1Ze2Inu90SOw8CRfgBPDHwA 提取码:zl6o
tar -zxvf libass-0.14.0.tar.xz
cd libass-0.14.0
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig
if [ -f autogen.sh ]; then
./autogen.sh
fi
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include -I${BUILD_LIBS}/include/freetype2" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
- 下载编译faac
fdk-aac-2.0.1百度云地址:https://pan.baidu.com/s/1qgs3Qxf2U0OrqePbsOdjVg 提取码:f1br
tar -zxvf fdk-aac-2.0.1.tar.gz
cd fdk-aac-2.0.1
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
if [ -f autogen.sh ]; then
./autogen.sh
fi
autoreconf -fiv
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
- 下载编译zlib
zlib-1.2.11百度云地址:https://pan.baidu.com/s/12IE_IwNjf6f1XtQ3AMzbxw 提取码:lqcp
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
BUILD_LIBS=${HOME}/telecom/build_libs
./configure \
--prefix=${BUILD_LIBS}
make
make install
# cp zlib.h ${BUILD_LIBS}/include
# cp zconf.h ${BUILD_LIBS}/include
# cp libz.* ${BUILD_LIBS}/lib
- 下载编译libpng
libpng-1.6.37百度云地址:https://pan.baidu.com/s/1F--nqESxaT8YEb7uCsPLqg 提取码:sah6
tar -zxvf libpng-1.6.37.tar.gz
cd libpng-1.6.37/
BUILD_LIBS=${HOME}/build_libs
./autogen.sh
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译jpeglib
jpeglib百度云地址:https://pan.baidu.com/s/17i7d6xtU8gSY64SDKIQIEA 提取码:4ify
tar -xzvf jpegsrc.v9d.tar.gz
cd jpeg-9d
BUILD_LIBS=${HOME}/build_libs
chmod 777 configure
./configure \
--prefix=${BUILD_LIBS}
make
make install
- 下载编译SDL2
SDL2-2.0.14百度云地址:https://pan.baidu.com/s/1fd8Od68V6sjnYX9hxAB_3w 提取码:ir0t
tar -zxvf SDL2-2.0.10.tar.gz
cd SDL2-2.0.10
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译vorbis
libvorbis-1.3.6百度云地址:https://pan.baidu.com/s/1zJX4pra0bxT0FdgkScER_Q 提取码:tq7g
tar -zxvf libvorbis-1.3.6.tar.xz
cd libvorbis-1.3.6
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译libogg
libogg-1.3.4百度云地址:https://pan.baidu.com/s/1q7eGmoWizgOV3npEDjs8CA 提取码:61go
tar -zxvf libogg-1.3.4.tar.xz
cd libogg-1.3.4
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS} \
--disable-static \
--docdir=${BUILD_LIBS}/doc/libogg-1.3.4
make
make install
- 下载编译theora
libtheora-1.1.1百度云地址:https://pan.baidu.com/s/1gLXCxIqb07xXxP6pQjAbug 提取码:hs2i
tar -zxvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
# sed -i 's/png_\(sizeof\)/\1/g' examples/png2theora.c
./autogen.sh
autoreconf -fiv
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
- 下载编译libspeex/libspeexdsp
libtheora-1.1.1百度云地址:https://pan.baidu.com/s/12g1ZXPjK_6jpJspD-Zw38g 提取码:yyyj
tar -zxvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
BUILD_LIBS=${HOME}/build_libs
export PATH=${BUILD_LIBS}/bin:${PATH}
export PKG_CONFIG_PATH=${BUILD_LIBS}/lib/pkgconfig:${PKG_CONFIG_PATH}
# sed -i 's/png_\(sizeof\)/\1/g' examples/png2theora.c
./autogen.sh
autoreconf -fiv
./configure \
--prefix=${BUILD_LIBS} \
CFLAGS="-I${BUILD_LIBS}/include" \
LDFLAGS="-L${BUILD_LIBS}/lib"
make
make install
- 下载编译nasm
nasm-2.15.04百度云地址:https://pan.baidu.com/s/1QONT9m_Bw82wSl5lZpqJEg 提取码:qndk
tar -zxvf nasm-2.15.04.tar.bz2
cd nasm-2.15.04
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译lame
lame-3.100百度云地址:https://pan.baidu.com/s/1PAm7KGBbOjoCDX-JhNORBA 提取码:iizq
tar -zxvf lame-3.100.tar.gz
cd lame-3.100/
BUILD_LIBS=${HOME}/build_libs
./configure --prefix=${BUILD_LIBS}
make
make install
- 下载编译ffmpeg
FFmpeg-release-4.3百度云地址:https://pan.baidu.com/s/1E4DzfsyxVsFqzI7osk70NA 提取码:7tav
BUILD_LIBS=${HOME}/build_libs
./configure \
--prefix=${BUILD_LIBS} \
--extra-cflags="-fPIC" \
--extra-cflags="-I${BUILD_LIBS}/include" \
--extra-ldflags="-L${BUILD_LIBS}/lib" \
--bindir="${BUILD_LIBS}/bin" \
--enable-pic --enable-pthreads \
--enable-shared --disable-static \
--disable-network --enable-pthreads \
--disable-ffmpeg --disable-ffplay --disable-ffprobe \
--enable-gpl --enable-nonfree \
--enable-libx264 --enable-encoder=libx264 --enable-decoder=h264 \
--disable-debug
# ./configure --pkg-config-flags="--static" --bindir="$HOME/bin" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
# --enable-memalign-hack
# --disable-ffserver
make
make install
cp libavfilter/motion_estimation.h ${BUILD_LIBS}/include/libavfilter