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)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章