用户工具

站点工具


ffmpeg_notes

FFmpeg 笔记

Resource

configure 脚本

Usage: configure [options]
Options: [defaults in brackets after descriptions]
 
Standard options:
  --help                   print this message
  --logfile=FILE           log tests and output to FILE [config.log]
  --disable-logging        do not log configure debug information
  --prefix=PREFIX          install in PREFIX []
  --bindir=DIR             install binaries in DIR [PREFIX/bin]
  --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
  --libdir=DIR             install libs in DIR [PREFIX/lib]
  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]
  --incdir=DIR             install includes in DIR [PREFIX/include]
  --mandir=DIR             install man page in DIR [PREFIX/share/man]
 
Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --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-doc            do not build documentation
  --disable-ffmpeg         disable ffmpeg build
  --disable-ffplay         disable ffplay build
  --disable-ffprobe        disable ffprobe build
  --disable-ffserver       disable ffserver build
  --disable-avdevice       disable libavdevice build
  --disable-avcodec        disable libavcodec build
  --disable-avformat       disable libavformat build
  --disable-swresample     disable libswresample build
  --disable-swscale        disable libswscale build
  --disable-postproc       disable libpostproc build
  --disable-avfilter       disable video filter support [no]
  --disable-pthreads       disable pthreads [auto]
  --disable-w32threads     disable Win32 threads [auto]
  --disable-os2threads     disable OS/2 threads [auto]
  --enable-x11grab         enable X11 grabbing [no]
  --disable-network        disable network support [no]
  --enable-gray            enable full grayscale support (slower color)
  --disable-swscale-alpha  disable alpha channel support in swscale
  --disable-fastdiv        disable table-based division
  --enable-small           optimize for size instead of speed
  --disable-aandct         disable AAN DCT code
  --disable-dct            disable DCT code
  --disable-fft            disable FFT code
  --disable-golomb         disable Golomb code
  --disable-huffman        disable Huffman code
  --disable-lpc            disable LPC code
  --disable-mdct           disable MDCT code
  --disable-rdft           disable RDFT code
  --enable-vaapi           enable VAAPI code [autodetect]
  --enable-vda             enable VDA code [autodetect]
  --enable-vdpau           enable VDPAU code [autodetect]
  --disable-dxva2          disable DXVA2 code
  --disable-vda            disable VDA code
  --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  --disable-safe-bitstream-reader
                           disable buffer boundary checking in bitreaders
                           (faster, but may crash)
  --enable-memalign-hack   emulate memalign, interferes with memory debuggers
  --disable-everything     disable all components listed below
  --disable-encoder=NAME   disable encoder NAME
  --enable-encoder=NAME    enable encoder NAME
  --disable-encoders       disable all encoders
  --disable-decoder=NAME   disable decoder NAME
  --enable-decoder=NAME    enable decoder NAME
  --disable-decoders       disable all decoders
  --disable-hwaccel=NAME   disable hwaccel NAME
  --enable-hwaccel=NAME    enable hwaccel NAME
  --disable-hwaccels       disable all hwaccels
  --disable-muxer=NAME     disable muxer NAME
  --enable-muxer=NAME      enable muxer NAME
  --disable-muxers         disable all muxers
  --disable-demuxer=NAME   disable demuxer NAME
  --enable-demuxer=NAME    enable demuxer NAME
  --disable-demuxers       disable all demuxers
  --enable-parser=NAME     enable parser NAME
  --disable-parser=NAME    disable parser NAME
  --disable-parsers        disable all parsers
  --enable-bsf=NAME        enable bitstream filter NAME
  --disable-bsf=NAME       disable bitstream filter NAME
  --disable-bsfs           disable all bitstream filters
  --enable-protocol=NAME   enable protocol NAME
  --disable-protocol=NAME  disable protocol NAME
  --disable-protocols      disable all protocols
  --disable-indev=NAME     disable input device NAME
  --disable-outdev=NAME    disable output device NAME
  --disable-indevs         disable input devices
  --disable-outdevs        disable output devices
  --disable-devices        disable all devices
  --enable-filter=NAME     enable filter NAME
  --disable-filter=NAME    disable filter NAME
  --disable-filters        disable all filters
  --list-decoders          show all available decoders
  --list-encoders          show all available encoders
  --list-hwaccels          show all available hardware accelerators
  --list-muxers            show all available muxers
  --list-demuxers          show all available demuxers
  --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
 
External library support:
  --enable-avisynth        enable reading of AVISynth script files [no]
  --enable-bzlib           enable bzlib [autodetect]
  --enable-frei0r          enable frei0r video filtering
  --enable-gnutls          enable gnutls [no]
  --enable-libaacplus      enable AAC+ encoding via libaacplus [no]
  --enable-libass          enable libass subtitles rendering [no]
  --enable-libcelt         enable CELT decoding via libcelt [no]
  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  --enable-libopencv       enable video filtering via libopencv [no]
  --enable-libcdio         enable audio CD grabbing with libcdio
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
                           and libraw1394 [no]
  --enable-libdirac        enable Dirac support via libdirac [no]
  --enable-libfaac         enable FAAC support via libfaac [no]
  --enable-libfreetype     enable libfreetype [no]
  --enable-libgsm          enable GSM support via libgsm [no]
  --enable-libmodplug      enable ModPlug via libmodplug [no]
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
  --enable-libnut          enable NUT (de)muxing via libnut,
                           native (de)muxer exists [no]
  --enable-libopenjpeg     enable JPEG 2000 encoding/decoding via OpenJPEG [no]
  --enable-libpulse        enable Pulseaudio input via libpulse [no]
  --enable-librtmp         enable RTMP[E] support via librtmp [no]
  --enable-libschroedinger enable Dirac support via libschroedinger [no]
  --enable-libspeex        enable Speex support via libspeex [no]
  --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
  --enable-libtheora       enable Theora encoding via libtheora [no]
  --enable-libutvideo      enable Ut Video decoding via libutvideo [no]
  --enable-libv4l2         enable libv4l2/v4l-utils [no]
  --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
  --enable-libvorbis       enable Vorbis encoding via libvorbis,
                           native implementation exists [no]
  --enable-libvpx          enable VP8 support via libvpx [no]
  --enable-libx264         enable H.264 encoding via x264 [no]
  --enable-libxavs         enable AVS encoding via xavs [no]
  --enable-libxvid         enable Xvid encoding via xvidcore,
                           native MPEG-4/Xvid encoder exists [no]
  --enable-openal          enable OpenAL 1.1 capture support [no]
  --enable-mlib            enable Sun medialib [no]
  --enable-openssl         enable openssl [no]
  --enable-zlib            enable zlib [autodetect]
 
Advanced options (experts only):
  --cross-prefix=PREFIX    use PREFIX for compilation tools []
  --enable-cross-compile   assume a cross-compiler is used
  --sysroot=PATH           root of cross-build tree
  --sysinclude=PATH        location of cross-build system headers
  --target-os=OS           compiler targets OS []
  --target-exec=CMD        command to run executables on target
  --target-path=DIR        path to view of build directory on target
  --nm=NM                  use nm tool NM [nm]
  --ar=AR                  use archive tool AR [ar]
  --as=AS                  use assembler AS []
  --yasmexe=EXE            use yasm-compatible assembler EXE [yasm]
  --cc=CC                  use C compiler CC [gcc]
  --cxx=CXX                use C compiler CXX [g++]
  --ld=LD                  use linker LD []
  --host-cc=HOSTCC         use host C compiler HOSTCC
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
  --host-libs=HLIBS        use libs HLIBS when linking for host
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS []
  --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS []
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
  --extra-libs=ELIBS       add ELIBS []
  --extra-version=STRING   version string suffix []
  --build-suffix=SUFFIX    library name suffix []
  --progs-suffix=SUFFIX    program name suffix []
  --arch=ARCH              select architecture []
  --cpu=CPU                select the minimum required CPU (affects
                           instruction selection, may crash on older CPUs)
  --disable-asm            disable all assembler optimizations
  --disable-altivec        disable AltiVec optimizations
  --disable-amd3dnow       disable 3DNow! optimizations
  --disable-amd3dnowext    disable 3DNow! extended optimizations
  --disable-mmx            disable MMX optimizations
  --disable-mmx2           disable MMX2 optimizations
  --disable-sse            disable SSE optimizations
  --disable-ssse3          disable SSSE3 optimizations
  --disable-avx            disable AVX optimizations
  --disable-armv5te        disable armv5te optimizations
  --disable-armv6          disable armv6 optimizations
  --disable-armv6t2        disable armv6t2 optimizations
  --disable-armvfp         disable ARM VFP optimizations
  --disable-iwmmxt         disable iwmmxt optimizations
  --disable-mmi            disable MMI optimizations
  --disable-neon           disable NEON optimizations
  --disable-vis            disable VIS optimizations
  --disable-yasm           disable use of yasm assembler
  --enable-pic             build position-independent code
  --malloc-prefix=PFX      prefix malloc and related names with PFX
  --enable-sram            allow use of on-chip SRAM
  --disable-symver         disable symbol versioning
  --optflags               override optimization-related compiler flags
  --postproc-version=V     build libpostproc version V.
                           Where V can be '51.2.101' or 'current'. [current]
 
Developer options (useful when working on FFmpeg itself):
  --enable-coverage        build with test coverage instrumentation
  --disable-debug          disable debugging symbols
  --enable-debug=LEVEL     set the debug level []
  --disable-optimizations  disable compiler optimizations
  --enable-extra-warnings  enable more compiler warnings
  --disable-stripping      disable stripping of executables and shared libraries
  --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
                           leaks and errors, using the specified valgrind binary.
                           Cannot be combined with --target-exec
  --samples=PATH           location of test samples for FATE, if not set use
                           $FATE_SAMPLES at make invocation time.
 
NOTE: Object files are built at the place where configure is launched.

Mac 下以 iOS 为目标平台进行交叉编译

如下 shell 脚本放在 ffmpeg 代码的根目录下执行,编译完成后会在 compiled 目录下找到 ARM6,ARM7 和 i386 的静态库,以及三合一的静态库。

export ARM_DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
export I386_DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
 
export ARM_CC=${ARM_DEVROOT}/usr/bin/llvm-gcc-4.2
export I386_CC=${I386_DEVROOT}/usr/bin/llvm-gcc-4.2
 
export ARM_SYSROOT=${ARM_DEVROOT}/SDKs/iPhoneOS5.1.sdk
export I386_SYSROOT=${I386_DEVROOT}/SDKs/iPhoneSimulator5.1.sdk
 
export ARM_LD=${ARM_DEVROOT}/SDKs/iPhoneOS5.1.sdk/usr/lib/system
export I386_LD=${I386_DEVROOT}/SDKs/iPhoneSimulator5.1.sdk/usr/lib/system
 
# configure for armv7 build
echo "Building armv7..."
./configure \
	--cc=${ARM_CC} \
	--as='gas-preprocessor.pl ${ARM_CC}' \
	--sysroot=${ARM_SYSROOT} \
	--extra-ldflags=-L${ARM_LD} \
	--target-os=darwin \
	--arch=arm \
	--cpu=cortex-a8 \
	--prefix=compiled/armv7 \
	--extra-cflags='-arch armv7' \
	--extra-ldflags='-arch armv7' \
	--enable-cross-compile \
	--disable-asm \
	--disable-armv5te \
	--disable-ffmpeg \
	--disable-ffplay \
	--disable-ffserver \
	--disable-ffprobe \
	--disable-network \
	--disable-decoders \
	--disable-muxers \
	--disable-demuxers \
	--disable-devices \
	--disable-parsers \
	--disable-encoders \
	--disable-protocols \
	--disable-filters \
	--disable-bsfs \
	--enable-decoder=h264 \
	--enable-decoder=svq3 \
	--enable-gpl \
	--enable-pic \
	--disable-doc
 
# build for armv7
make clean
make && make install
 
 
# configure for armv6 build
echo "Building armv6..."
./configure \
	--cc=${ARM_CC} \
	--as='gas-preprocessor.pl ${ARM_CC}' \
	--sysroot=${ARM_SYSROOT} \
	--extra-ldflags=-L${ARM_LD} \
	--target-os=darwin \
	--arch=arm \
	--cpu=arm1176jzf-s \
	--prefix=compiled/armv6 \
	--extra-cflags='-arch armv6' \
	--extra-ldflags='-arch armv6' \
	--enable-cross-compile \
	--disable-asm \
	--disable-armv5te \
	--disable-ffmpeg \
	--disable-ffplay \
	--disable-ffserver \
	--disable-ffprobe \
	--disable-network \
	--disable-decoders \
	--disable-muxers \
	--disable-demuxers \
	--disable-devices \
	--disable-parsers \
	--disable-encoders \
	--disable-protocols \
	--disable-filters \
	--disable-bsfs \
	--enable-decoder=h264 \
	--enable-decoder=svq3 \
	--enable-gpl \
	--enable-pic \
	--disable-doc
 
# build for armv6
make clean
make && make install
 
 
# configure for i386 build
echo "Building i386..."
./configure \
	--cc=${I386_CC} \
	--as='gas-preprocessor.pl ${I386_CC}' \
	--sysroot=${I386_SYSROOT} \
	--extra-ldflags=-L${I386_LD} \
	--target-os=darwin \
	--arch=i386 \
	--cpu=i386 \
	--prefix=compiled/i386 \
	--extra-cflags='-arch i386' \
	--extra-ldflags='-arch i386' \
	--enable-cross-compile \
	--disable-asm \
	--disable-armv5te \
	--disable-ffmpeg \
	--disable-ffplay \
	--disable-ffserver \
	--disable-ffprobe \
	--disable-network \
	--disable-decoders \
	--disable-muxers \
	--disable-demuxers \
	--disable-devices \
	--disable-parsers \
	--disable-encoders \
	--disable-protocols \
	--disable-filters \
	--disable-bsfs \
	--enable-decoder=h264 \
	--enable-decoder=svq3 \
	--enable-gpl \
	--enable-pic \
	--disable-doc
 
# build for i386
make clean
make && make install
 
 
# make fat (universal) libs
mkdir -p ./compiled/fat/lib
 
FFMPEG_LIBS="libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale"
for i in ${FFMPEG_LIBS}; do lipo -create ./compiled/armv6/lib/$i.a ./compiled/armv7/lib/$i.a ./compiled/i386/lib/$i.a -output ./compiled/fat/lib/$i.a; done
  • 需要根据本机上编译器安装位置和 SDK 位置对编译脚本进行调整
  • gas-preprocessor.pl 可以在 https://github.com/yuvi/gas-preprocessor 下载到
  • 貌似 arm-apple-darwin10-llvm-gcc-4.2 只能用于产生 ARM 平台的代码,而且不可以接受 -arch armv7 这样的参数;i686-apple-darwin10-llvm-gcc-4.2 只能用于产生 i386 平台的代码,也不可以接受 -arch 这个选项;但是用 llvm-gcc-4.2 就没问题。所以要注意 –cc 跟 –extra-cflags 的搭配。
  • 如果不加 –disable-asm 的话,会遇到类似“error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31”这样的错误,加上就好了,但是禁用汇编的同时降低的效率
  • 如果遇到 configure 阶段的错误,查看 config.log 是非常不错的除错手段

Mac 下以 Android 为目标平台进行交叉编译

ffmpeg_notes.txt · 最后更改: 2012/08/06 10:45 由 2ndboy