文档说明
帮助选项
Help options:
--help print this message
--quiet Suppress showing informative output
--list-decoders show all available decoders
--list-encoders show all available encoders
--list-hwaccels show all available hardware accelerators
--list-demuxers show all available demuxers
--list-muxers show all available muxers
--list-parsers show all available parsers
--list-protocols show all available protocols
--list-bsfs show all available bitstream filters
--list-indevs show all available input devices
--list-outdevs show all available output devices
--list-filters show all available filters
标准选项
Standard options:
--logfile=FILE log tests and output to FILE [ffbuild/config.log]
--disable-logging do not log configure debug information
--fatal-warnings fail if any configure warning is generated
我们最终产出的目录,c框架都有这个
--prefix=PREFIX install in PREFIX [/usr/local]
--bindir=DIR install binaries in DIR [PREFIX/bin]
--datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
--docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
--libdir=DIR install libs in DIR [PREFIX/lib]
--shlibdir=DIR install shared libs in DIR [LIBDIR]
--incdir=DIR install includes in DIR [PREFIX/include]
--mandir=DIR install man page in DIR [PREFIX/share/man]
--pkgconfigdir=DIR install pkg-config files in DIR [LIBDIR/pkgconfig]
--enable-rpath use rpath to allow installing libraries in paths
not part of the dynamic linker search path
use rpath when linking programs (USE WITH CARE)
--install-name-dir=DIR Darwin directory name for installed targets
Licensing options:
--enable-gpl allow use of GPL code, the resulting libs
and binaries will be under GPL [no]
--enable-version3 upgrade (L)GPL to version 3 [no]
--enable-nonfree allow use of nonfree code, the resulting libs
and binaries will be unredistributable [no]
--disable 代表关闭状态
--enable 代表开启状态
Configuration options:
--disable-static do not build static libraries [no] == 开启静态库,no是取反
--enable-shared build shared libraries [no] == 关闭动态库
--enable-small optimize for size instead of speed == 可以优化库的大小,有这个的c库,开源框架强大
--disable-runtime-cpudetect disable detecting CPU capabilities at runtime (smaller binary)
--enable-gray enable full grayscale support (slower color)
--disable-swscale-alpha disable alpha channel support in swscale
--disable-all disable building components, libraries and programs
--disable-autodetect disable automatically detected external libraries [no]
Program options:
--disable-programs do not build command line programs == 默认是关闭的,如果我们开启就会生成下面三个东东
--disable-ffmpeg disable ffmpeg build == 使用FFmpeg命令
--disable-ffplay disable ffplay build == 播放器
--disable-ffprobe disable ffprobe build
Documentation options:
--disable-doc do not build documentation
--disable-htmlpages do not build HTML documentation pages
--disable-manpages do not build man documentation pages
--disable-podpages do not build POD documentation pages
--disable-txtpages do not build text documentation pages
FFmpeg 是由多个模块组成的:
Component options:
--disable-avdevice disable libavdevice build == 模块之一(可以操控我们的摄像头-(Android中是不支持))
--disable-avcodec disable libavcodec build == av是audio video的简写 codec(编码 和 解码)
--disable-avformat disable libavformat build == 音视频格式生成和解析相关
--disable-swresample disable libswresample build == 音频 重采样(如果想把单声道,变成双声道)
--disable-swscale disable libswscale build == 对视频显示相关(对视频的缩放,放大 缩小)
--disable-postproc disable libpostproc build == 后期处理,很少用,可以关闭掉
--disable-avfilter disable libavfilter build == 给视频加水印,加字幕,特殊效果
--enable-avresample enable libavresample build (deprecated) [no]
--disable-pthreads disable pthreads [autodetect]
--disable-w32threads disable Win32 threads [autodetect]
--disable-os2threads disable OS/2 threads [autodetect]
--disable-network disable network support [no]
--disable-dct disable DCT code
--disable-dwt disable DWT code
--disable-error-resilience disable error resilience code
--disable-lsp disable LSP code
--disable-lzo disable LZO decoder code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
--disable-fft disable FFT code
--disable-faan disable floating point AAN (I)DCT code
--disable-pixelutils disable pixel utils in libavutil
Individual component options:
--disable-everything disable all components listed below
--disable-encoder=NAME disable encoder NAME
--enable-encoder=NAME enable encoder NAME
--disable-encoders disable all encoders == 如果我们去播放视频,不需要编码,那么此功能就可以关闭掉
Linux 上编译ffmpeg
./configure会报错误nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.
./configure --disable-x86asm
写个.sh文件用NDK编译ffmpeg
#执行configure脚本,用于生成makefile
#--prefix:安装目录
#--enable-small:优化大小
#--disable-avdevice:关闭所有编码器(播放不需要编码)
#--disable-muxers:关闭所有复用器(封装器),不需要生成MP4这样的文件,所以关闭
#--disable-filters:关闭视频滤镜
#--enable-cross-compile:开启交叉编译
#disable-shared enable-static:不写也可以,默认就是这样
#--sysroot
#--extra-cflags:会传给gcc的参数
#--arch--target-os:
NDK_ROOT=ndk路径
TOOLCHAIN=路径
PREFIX=./android/armeabi-v7a2
./configure \
--prefix=$PREFIX \
--enable-small \
--disable-programs \
--disable-avdevice \
--disable-encoders \
--disable-muxers \
--disable-filters \
--enable-cross-compile \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--disable-shared \
--enable-static \
--sysroot=$NDK_ROOT/platforms/android-17/arch-arm \
#兼容cmake和ninjia -D__ANDROID_API创建宏,-U_FILE_OFFSET_BITS -DANDROID删除一个宏
--extra-cflags="-isysroot $NDK_ROOT/sysroot -isystem $NDK_ROOT/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=17 -U_FILE_OFFSET_BITS -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fPIC" \
#指定arm平台
--arch=arm \
#指定操作系统
--target-os=android
#清理
make clean
#安装
make install