ffmpeg ./configure 的相关参数说明

帮助选项(Help options)

用于查看ffmpeg的能力

选项说明
–helpprint this message
–list-decoders显示所有可用的解码器(h264/mjpeg等)
–list-encoders显示所有可用的编码器(h264/mjpeg等)
–list-hwaccels显示所有支持的硬编解码器(h264_videotoolbox/h264_mediacodec等)
–list-demuxers显示所有支持解复用的容器(mp4/h264等)
–list-muxers显示所有支持复用的容器(mp4/h264等)
–list-parsersshow all available parsers
–list-protocols显示所有支持的传输协议(rtmp/rtp等)
–list-bsfs显示所有可用的格式转换(h264_mp4toannexb/aac_adtstoasc等)
–list-indevs显示所有支持的输入设备(alsa/v4l2等)
–list-outdevs显示所有支持的输出设备(alsa/opengl等)
–list-filters显示支持的所有过滤器(scale/volume/fps/allyuv等)

标准选项(Standard options)

编译配置

选项说明
–logfile=FILE配置过程中的log输出文件,默认输出到当前位置的ffbuild/config.log文件
–disable-logging配置过程中不输出日志
–fatal-warnings把配置过程中的任何警告当做致命的错误处理
–prefix=PREFIX设定安装的跟目录,如果不指定默认是/usr
–bindir=DIR设置可执行程序的安装位置,默认是[PREFIX/bin]
–datadir=DIR设置测试程序以及数据的安装位置,默认是[PREFIX/share/ffmpeg]
–docdir=DIR设置文档的安装目录,默认是[PREFIX/share/doc/ffmpeg]
–libdir=DIR设置静态库的安装位置,默认是[PREFIX/lib]
–shlibdir=DIR设置动态库的安装位置,默认是[LIBDIR]
–incdir=DIR设置头文件的安装位置,默认是[PREFIX/include];一般来说用于依赖此头文件来开发就够了
–mandir=DIR设置man文件的安装目录,默认是[PREFIX/share/man]
–pkgconfigdir=DIR设置pkgconfig的安装目录,默认是[LIBDIR/pkgconfig],只有--enable-shared使能的时候这个选项才有效
–enable-rpathuse 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=DIRDarwin directory name for installed targets

许可证选项(Licensing options)

选择许可证,FFMPEG默认许可证LGPL 2.1,如果需要加gpl的库需要使用gpl的许可证,例如libx264就是gpl的,如果需要加入libx264则需要--enable-gpl

选项说明
–enable-gplallow use of GPL code, the resulting libs and binaries will be under GPL [no]
–enable-version3upgrade (L)GPL to version 3 [no]
–enable-nonfreeallow use of nonfree code, the resulting libs and binaries will be unredistributable [no]

配置选项(Configuration options)

编译选项的配置

选项说明
–disable-static不生产静态库,默认生成静态库
–enable-shared生成动态库,默认不生成动态库
–enable-smalloptimize for size instead of speed,默认开启
–disable-runtime-cpudetectdisable detecting cpu capabilities at runtime (smaller binary),默认开启
–enable-grayenable full grayscale support (slower color)
–disable-swscale-alphadisable alpha channel support in swscale
–disable-all禁止编译所有库和可执行程序
–enable-raise-major增加主版本号

程序选项(Program options)

可执行程序开启选项,默认编译ffmpeg中的所有可执行程序,包括ffmpeg、ffplay、ffprobe、ffserver,不过Mac平台默认情况下不生成ffplay,目前暂未知道啥原因。

选项说明
–disable-programsdo not build command line programs
–disable-ffmpegdisable ffmpeg build
–disable-ffplaydisable ffplay build
–disable-ffprobedisable ffprobe build
–disable-ffserverdisable ffserver build

文档选项(Documentation options)

离线文档选择

选项说明
–disable-docdo not build documentation
–disable-htmlpagesdo not build HTML documentation pages
–disable-manpagesdo not build man documentation pages
–disable-podpagesdo not build POD documentation pages
–disable-txtpagesdo not build text documentation pages

组件选项(Component options)

除了avresample模块,默认编译所有模块。一般来说用于轻量化ffmpeg库的大小,可以仅仅开启指定某些组件的某些功能。

选项说明
–disable-avdevicedisable libavdevice build
–disable-avcodecdisable libavcodec build
–disable-avformatdisable libavformat build
–disable-swresampledisable libswresample build
–disable-swscaledisable libswscale build
–disable-postprocdisable libpostproc build
–disable-avfilterdisable libavfilter build
–enable-avresampleenable libavresample build [no]
–disable-pthreadsdisable pthreads [autodetect]
–disable-w32threadsdisable Win32 threads [autodetect]
–disable-os2threadsdisable OS/2 threads [autodetect]
–disable-networkdisable network support [no]
–disable-dctdisable DCT code
–disable-dwtdisable DWT code
–disable-error-resiliencedisable error resilience code
–disable-lspdisable LSP code
–disable-lzodisable LZO decoder code
–disable-mdctdisable MDCT code
–disable-rdftdisable RDFT code
–disable-fftdisable FFT code
–disable-faandisable floating point AAN (I)DCT code
–disable-pixelutilsdisable pixel utils in libavutil

个别组件选项(Individual component options)

可以用于设定开启指定功能,例如禁止所有encoders,在这里可以开启特定的encoders(x264、aac等)

选项说明
–disable-everythingdisable all components listed below
–disable-encoder=NAMEdisable encoder NAME
–enable-encoder=NAMEenable encoder NAME
–disable-encodersdisable all encoders
–disable-decoder=NAMEdisable decoder NAME
–enable-decoder=NAMEenable decoder NAME
–disable-decodersdisable all decoders
–disable-hwaccel=NAMEdisable hwaccel NAME
–enable-hwaccel=NAMEenable hwaccel NAME
–disable-hwaccelsdisable all hwaccels
–disable-muxer=NAMEdisable muxer NAME
–enable-muxer=NAMEenable muxer NAME
–disable-muxersdisable all muxers
–disable-demuxer=NAMEdisable demuxer NAME
–enable-demuxer=NAMEenable demuxer NAME
–disable-demuxersdisable all demuxers
–enable-parser=NAMEenable parser NAME
–disable-parser=NAMEdisable parser NAME
–disable-parsersdisable all parsers
–enable-bsf=NAMEenable bitstream filter NAME
–disable-bsf=NAMEdisable bitstream filter NAME
–disable-bsfsdisable all bitstream filters
–enable-protocol=NAMEenable protocol NAME
–disable-protocol=NAMEdisable protocol NAME
–disable-protocolsdisable all protocols
–enable-indev=NAMEenable input device NAME
–disable-indev=NAMEdisable input device NAME
–disable-indevsdisable input devices
–enable-outdev=NAMEenable output device NAME
–disable-outdev=NAMEdisable output device NAME
–disable-outdevsdisable output devices
–disable-devicesdisable all devices
–enable-filter=NAMEenable filter NAME
–disable-filter=NAMEdisable filter NAME
–disable-filtersdisable all filters

扩展库支持(External library support)

ffmpeg提供的一些功能是由其他扩展库支持的,如果需要使用需要明确声明,确定编译的第三方库的目标架构--arch相同就好了,在编译ffmpeg的时候需加入第三方库的头文和库搜索路径(通过extra-cflagsextra-ldflags指定即可),剩下的事ffmpeg都给你做好了。

$ git clone http://source.ffmpeg.org/git/ffmpeg.git
$ cd x264
$ ./configure --prefix=$FFMPEG_PREFIX --enable-static --enable-shared
$ make -j8 && make install
  • 1
  • 2
  • 3
  • 4
选项说明
–enable-avisynthenable reading of AviSynth script files [no]
–disable-bzlibdisable bzlib [autodetect]
–enable-chromaprintenable audio fingerprinting with chromaprint [no]
–enable-frei0renable frei0r video filtering [no]
–enable-gcryptenable gcrypt, needed for rtmp(t)e support if openssl, librtmp or gmp is not used [no]
–enable-gmpenable gmp, needed for rtmp(t)e support if openssl or librtmp is not used [no]
–enable-gnutlsenable gnutls, needed for https support if openssl is not used [no]
–disable-iconvdisable iconv [autodetect]
–enable-jnienable JNI support [no]
–enable-ladspaenable LADSPA audio filtering [no]
–enable-libassenable libass subtitles rendering, needed for subtitles and ass filter [no]
–enable-libblurayenable BluRay reading using libbluray [no]
–enable-libbs2benable bs2b DSP library [no]
–enable-libcacaenable textual display using libcaca [no]
–enable-libceltenable CELT decoding via libcelt [no]
–enable-libcdioenable audio CD grabbing with libcdio [no]
–enable-libdc1394enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no]
–enable-libebur128enable libebur128 for EBU R128 measurement, needed for loudnorm filter [no]
–enable-libfdk-aacenable AAC de/encoding via libfdk-aac [no]
–enable-libfliteenable flite (voice synthesis) support via libflite [no]
–enable-libfontconfigenable libfontconfig, useful for drawtext filter [no]
–enable-libfreetypeenable libfreetype, needed for drawtext filter [no]
–enable-libfribidienable libfribidi, improves drawtext filter [no]
–enable-libgmeenable Game Music Emu via libgme [no]
–enable-libgsmenable GSM de/encoding via libgsm [no]
–enable-libiec61883enable iec61883 via libiec61883 [no]
–enable-libilbcenable iLBC de/encoding via libilbc [no]
–enable-libkvazaarenable HEVC encoding via libkvazaar [no]
–enable-libmodplugenable ModPlug via libmodplug [no]
–enable-libmp3lameenable MP3 encoding via libmp3lame [no]
–enable-libnutenable NUT (de)muxing via libnut, native (de)muxer exists [no]
–enable-libopencore-amrnbenable AMR-NB de/encoding via libopencore-amrnb [no]
–enable-libopencore-amrwbenable AMR-WB decoding via libopencore-amrwb [no]
–enable-libopencvenable video filtering via libopencv [no]
–enable-libopenh264enable H.264 encoding via OpenH264 [no]
–enable-libopenjpegenable JPEG 2000 de/encoding via OpenJPEG [no]
–enable-libopenmptenable decoding tracked files via libopenmpt [no]
–enable-libopusenable Opus de/encoding via libopus [no]
–enable-libpulseenable Pulseaudio input via libpulse [no]
–enable-librubberbandenable rubberband needed for rubberband filter [no]
–enable-librtmpenable RTMP[E] support via librtmp [no]
–enable-libschroedingerenable Dirac de/encoding via libschroedinger [no]
–enable-libshineenable fixed-point MP3 encoding via libshine [no]
–enable-libsmbclientenable Samba protocol via libsmbclient [no]
–enable-libsnappyenable Snappy compression, needed for hap encoding [no]
–enable-libsoxrenable Include libsoxr resampling [no]
–enable-libspeexenable Speex de/encoding via libspeex [no]
–enable-libsshenable SFTP protocol via libssh [no]
–enable-libtesseractenable Tesseract, needed for ocr filter [no]
–enable-libtheoraenable Theora encoding via libtheora [no]
–enable-libtwolameenable MP2 encoding via libtwolame [no]
–enable-libv4l2enable libv4l2/v4l-utils [no]
–enable-libvidstabenable video stabilization using vid.stab [no]
–enable-libvo-amrwbencenable AMR-WB encoding via libvo-amrwbenc [no]
–enable-libvorbisenable Vorbis en/decoding via libvorbis, native implementation exists [no]
–enable-libvpxenable VP8 and VP9 de/encoding via libvpx [no]
–enable-libwavpackenable wavpack encoding via libwavpack [no]
–enable-libwebpenable WebP encoding via libwebp [no]
–enable-libx264enable H.264 encoding via x264 [no]
–enable-libx265enable HEVC encoding via x265 [no]
–enable-libxavsenable AVS encoding via xavs [no]
–enable-libxcbenable X11 grabbing using XCB [autodetect]
–enable-libxcb-shmenable X11 grabbing shm communication [autodetect]
–enable-libxcb-xfixesenable X11 grabbing mouse rendering [autodetect]
–enable-libxcb-shapeenable X11 grabbing shape rendering [autodetect]
–enable-libxvidenable Xvid encoding via xvidcore, native MPEG-4/Xvid encoder exists [no]
–enable-libzimgenable z.lib, needed for zscale filter [no]
–enable-libzmqenable message passing via libzmq [no]
–enable-libzvbienable teletext support via libzvbi [no]
–disable-lzmadisable lzma [autodetect]
–enable-decklinkenable Blackmagic DeckLink I/O support [no]
–enable-mediacodecenable Android MediaCodec support [no]
–enable-netcdfenable NetCDF, needed for sofalizer filter [no]
–enable-openalenable OpenAL 1.1 capture support [no]
–enable-openclenable OpenCL code
–enable-openglenable OpenGL rendering [no]
–enable-opensslenable openssl, needed for https support if gnutls is not used [no]
–disable-schanneldisable SChannel SSP, needed for TLS support on Windows if openssl and gnutls are not used [autodetect]
–disable-sdl2disable sdl2 [autodetect]
–disable-securetransportdisable Secure Transport, needed for TLS support on OSX if openssl and gnutls are not used [autodetect]
–enable-x11grabenable X11 grabbing (legacy) [no]
–disable-xlibdisable xlib [autodetect]
–disable-zlibdisable zlib [autodetect]

硬件加速功能(hardware acceleration features)

ffmpeg默认实现了移动端(Android和IOS)的硬编解码,可以选择disable的都是默认开启的,可以关闭,可以选择enable的都是需要自己解决依赖的。

选项说明
–disable-audiotoolboxdisable Apple AudioToolbox code [autodetect]
–enable-cudaenable dynamically linked Nvidia CUDA code [no]
–enable-cuvidenable Nvidia CUVID support [autodetect]
–disable-d3d11vadisable Microsoft Direct3D 11 video acceleration code [autodetect]
–disable-dxva2disable Microsoft DirectX 9 video acceleration code [autodetect]
–enable-libmfxenable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
–enable-libnppenable Nvidia Performance Primitives-based code [no]
–enable-mmalenable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
–disable-nvencdisable Nvidia video encoding code [autodetect]
–enable-omxenable OpenMAX IL code [no]
–enable-omx-rpienable OpenMAX IL code for Raspberry Pi [no]
–disable-vaapidisable Video Acceleration API (mainly Unix/Intel) code [autodetect]
–disable-vdadisable Apple Video Decode Acceleration code [autodetect]
–disable-vdpaudisable Nvidia Video Decode and Presentation API for Unix code [autodetect]
–disable-videotoolboxdisable VideoToolbox code [autodetect]

工具链选项(Toolchain options)

ffmpeg代码本身是支持跨平台的,要编译不同的平台需要配置不同平台的交叉编译工具链。ffmpeg都是c代码,所以不需要配置c++的sysroot。常用的就几个arch,cpu,cross-prefix,enable-cross-compile,sysroot,target-os,extra-cflags,extra-ldflags,enable-pic。现在Android和IOS几乎没有armv5的设备了,所以如果编译这两个平台配置armv7和armv8就好了。

选项说明
–arch=ARCH选择目标架构[armv7a/aarch64/x86/x86_64等]
–cpu=CPU选择目标cpu[armv7-a/armv8-a/x86/x86_64]
–cross-prefix=PREFIX设定交叉编译工具链的前缀,不算gcc/nm/as命令,例如android 32位的交叉编译链$ndk_dir/toolchains/arm-linux-androideabi-$toolchain_version/prebuilt/linux-$host_arch/bin/arm-linux-androideabi-
–progs-suffix=SUFFIXprogram name suffix []
–enable-cross-compile如果目标平台和编译平台不同则需要使能它
–sysroot=PATH交叉工具链的头文件和库位,例如Android 32位位置$ndk_dir/platforms/android-14/arch-arm
–sysinclude=PATHlocation of cross-build system headers
–target-os=OS设置目标系统
–target-exec=CMDcommand to run executables on target
–target-path=DIRpath to view of build directory on target
–target-samples=DIRpath to samples directory on target
–tempprefix=PATHforce fixed dir/prefix instead of mktemp for checks
–toolchain=NAMEset tool defaults according to NAME
–nm=NMuse nm tool NM [nm -g]
–ar=ARuse archive tool AR [ar]
–as=ASuse assembler AS []
–ln_s=LN_Suse symbolic link tool LN_S [ln -s -f]
–strip=STRIPuse strip tool STRIP [strip]
–windres=WINDRESuse windows resource compiler WINDRES [windres]
–yasmexe=EXEuse yasm-compatible assembler EXE [yasm]
–cc=CCuse C compiler CC [gcc]
–cxx=CXXuse C compiler CXX [g++]
–objcc=OCCuse ObjC compiler OCC [gcc]
–dep-cc=DEPCCuse dependency generator DEPCC [gcc]
–ld=LDuse linker LD []
–pkg-config=PKGCONFIGuse pkg-config tool PKGCONFIG [pkg-config]
–pkg-config-flags=FLAGSpass additional flags to pkgconf []
–ranlib=RANLIBuse ranlib RANLIB [ranlib]
–doxygen=DOXYGENuse DOXYGEN to generate API doc [doxygen]
–host-cc=HOSTCCuse host C compiler HOSTCC
–host-cflags=HCFLAGSuse HCFLAGS when compiling for host
–host-cppflags=HCPPFLAGSuse HCPPFLAGS when compiling for host
–host-ld=HOSTLDuse host linker HOSTLD
–host-ldflags=HLDFLAGSuse HLDFLAGS when linking for host
–host-libs=HLIBSuse libs HLIBS when linking for host
–host-os=OScompiler host OS []
–extra-cflags=ECFLAGS设置cflags,如果是Android平台可以根据ndk内的设定,arm-linux-androideabi-4.6/setup.mk,建议参考你当前的setup来配置
–extra-cxxflags=ECFLAGSadd ECFLAGS to CXXFLAGS []
–extra-objcflags=FLAGSadd FLAGS to OBJCFLAGS []
–extra-ldflags=ELDFLAGS参考cflags
–extra-ldexeflags=ELDFLAGSadd ELDFLAGS to LDEXEFLAGS []
–extra-ldlibflags=ELDFLAGSadd ELDFLAGS to LDLIBFLAGS []
–extra-libs=ELIBSadd ELIBS []
–extra-version=STRINGversion string suffix []
–optflags=OPTFLAGSoverride optimization-related compiler flags
–build-suffix=SUFFIXlibrary name suffix []
–enable-picbuild position-independent code
–enable-thumbcompile for Thumb instruction set
–enable-ltouse link-time optimization
–env=”ENV=override”override the environment variables

高级选项(Advanced options)

选项说明
–malloc-prefix=PREFIXprefix malloc and related names with PREFIX
–custom-allocator=NAMEuse a supported custom allocator
–disable-symverdisable symbol versioning
–enable-hardcoded-tablesuse hardcoded tables instead of runtime generation
–disable-safe-bitstream-readerdisable buffer boundary checking in bitreaders (faster, but may crash)
–enable-memalign-hackemulate memalign, interferes with memory debuggers
–sws-max-filter-size=Nthe max filter size swscale uses [256]

优化选项(Optimization options)

默认开启各个平台的汇编优化,有些嵌入式平台可能并不能完整的支持架构的所有汇编指令,所以需要关闭。(自己理解的,没有实战)

选项说明
–disable-asmdisable all assembly optimizations
–disable-altivecdisable AltiVec optimizations
–disable-vsxdisable VSX optimizations
–disable-power8disable POWER8 optimizations
–disable-amd3dnowdisable 3DNow! optimizations
–disable-amd3dnowextdisable 3DNow! extended optimizations
–disable-mmxdisable MMX optimizations
–disable-mmxextdisable MMXEXT optimizations
–disable-ssedisable SSE optimizations
–disable-sse2disable SSE2 optimizations
–disable-sse3disable SSE3 optimizations
–disable-ssse3disable SSSE3 optimizations
–disable-sse4disable SSE4 optimizations
–disable-sse42disable SSE4.2 optimizations
–disable-avxdisable AVX optimizations
–disable-xopdisable XOP optimizations
–disable-fma3disable FMA3 optimizations
–disable-fma4disable FMA4 optimizations
–disable-avx2disable AVX2 optimizations
–disable-aesnidisable AESNI optimizations
–disable-armv5tedisable armv5te optimizations
–disable-armv6disable armv6 optimizations
–disable-armv6t2disable armv6t2 optimizations
–disable-vfpdisable VFP optimizations
–disable-neondisable NEON optimizations
–disable-inline-asmdisable use of inline assembly
–disable-yasmdisable use of nasm/yasm assembly
–disable-mipsdspdisable MIPS DSP ASE R1 optimizations
–disable-mipsdspr2disable MIPS DSP ASE R2 optimizations
–disable-msadisable MSA optimizations
–disable-mipsfpudisable floating point MIPS optimizations
–disable-mmidisable Loongson SIMD optimizations
–disable-fast-unalignedconsider unaligned accesses slow

开发者选项(Developer options)

调试用的一些开关

选项说明
–disable-debugdisable debugging symbols
–enable-debug=LEVELset the debug level []
–disable-optimizationsdisable compiler optimizations
–enable-extra-warningsenable more compiler warnings
–disable-strippingdisable stripping of executables and shared libraries
–assert-level=level0(default), 1 or 2, amount of assertion testing, 2 causes a slowdown at runtime.
–enable-memory-poisoningfill heap uninitialized allocated space with arbitrary data
–valgrind=VALGRINDrun “make fate” tests through valgrind to detect memory leaks and errors, using the specified valgrind binary. Cannot be combined with –target-exec
–enable-ftrapvTrap arithmetic overflows
–samples=PATHlocation of test samples for FATE, if not set use $FATE_SAMPLES at make invocation time.
–enable-neon-clobber-testcheck NEON registers for clobbering (should be used only for debugging purposes)
–enable-xmm-clobber-testcheck XMM registers for clobbering (Win64-only; should be used only for debugging purposes)
–enable-randomrandomly enable/disable components
–disable-random 
–enable-random=LISTrandomly enable/disable specific components or
–disable-random=LISTcomponent groups. LIST is a comma-separated list of NAME[:PROB] entries where NAME is a component (group) and PROB the probability associated with
–random-seed=VALUEseed value for –enable/disable-random
–disable-valgrind-backtracedo not print a backtrace under Valgrind (only applies to –disable-optimizations builds)
  • 8
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值