FFmpeg学习(2) 源码编译, 环境配置(下 )

2. FFmpeg源码下载

FFmpeg源码下载肯定是优先去官网下载:官网 ffmpeg.org/download.ht…

打开官网如下:

可以选择直接下载,或者git命令直接克隆一份,作为开发人员一般都喜欢选择git克隆的方式,这样方便后续更新。

★文末名片可以免费领取音视频开发学习资料,内容包括(FFmpeg ,webRTC ,rtmp ,hls ,rtsp ,ffplay ,srs)以及音视频学习路线图等等。

见下方!↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

3. FFmpeg编译,安装

3.1 在Mac下编译安装FFmpeg

3.1.1 brew 方式安装

在mac下面可以很方便的使用brew install ffmpeg命令直接安装ffmpeg,如果是新手这样安装比较方便快捷,但是这么安装有个弊端就是不能定制化,如果随着你对FFmpeg的深入,你需要使用一些其他的工具,就需要手动编译安装了,通过源码编译的方式,我们可以自己选择定制化。

我们可以先输入brew search ffmpeg
 

3.1.2 源码编译 方式安装

首先需要下载ffmpeg, 从官网http://ffmpeg.org/download.html下载
然后是编译ffmpeg 只需要执行下面3条命令即可:

  1. ./configure -prefix=/usr/local/ffmpeg -enable-debug=3
  2. make -j 4
  3. make install

接下来我们分别执行这3条语句:

  • 执行./configure --prefix=/usr/local/ffmpeg --enable-debug=3 一般我们默认安装在/usr/local/ffmpeg路径下,这个路径可以自由设定,这里我们需要开启debug功能,后面要用到

我们下看看我们下载好的源码目录
 

你也可以使用./configure --help来查看怎么配置

会打印如下所有选项:

Usage: configure [options]
Options: [defaults in brackets after descriptions]

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
  --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]

Configuration options:
  --disable-static         do not build static libraries [no]
  --enable-shared          build shared libraries [no]
  --enable-small           optimize for size instead of speed
  --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
  --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

Component options:
  --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 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
  --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
  --enable-indev=NAME      enable input device NAME
  --disable-indev=NAME     disable input device NAME
  --disable-indevs         disable input devices
  --enable-outdev=NAME     enable output device NAME
  --disable-outdev=NAME    disable output device NAME
  --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

External library support:

  Using any of the following switches will allow FFmpeg to link to the
  corresponding external library. All the components depending on that library
  will become enabled, if all their other dependencies are met and they are not
  explicitly disabled. E.g. --enable-libwavpack will enable linking to
  libwavpack and allow the libwavpack encoder to be built, unless it is
  specifically disabled with --disable-encoder=libwavpack.

  Note that only the system libraries are auto-detected. All the other external
  libraries must be explicitly enabled.

  Also note that the following help text describes the purpose of the libraries
  themselves, not all their features will necessarily be usable by FFmpeg.

  --disable-alsa           disable ALSA support [autodetect]
  --disable-appkit         disable Apple AppKit framework [autodetect]
  --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
  --enable-avisynth        enable reading of AviSynth script files [no]
  --disable-bzlib          disable bzlib [autodetect]
  --disable-coreimage      disable Apple CoreImage framework [autodetect]
  --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
  --enable-frei0r          enable frei0r video filtering [no]
  --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support
                           if openssl, librtmp or gmp is not used [no]
  --enable-gmp             enable gmp, needed for rtmp(t)e support
                           if openssl or librtmp is not used [no]
  --enable-gnutls          enable gnutls, needed for https support
                           if openssl, libtls or mbedtls is not used [no]
  --disable-iconv          disable iconv [autodetect]
  --enable-jni             enable JNI support [no]
  --enable-ladspa          enable LADSPA audio filtering [no]
  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
  --enable-libaribb24      enable ARIB text and caption decoding via libaribb24 [no]
  --enable-libass          enable libass subtitles rendering,
                           needed for subtitles and ass filter [no]
  --enable-libbluray       enable BluRay reading using libbluray [no]
  --enable-libbs2b         enable bs2b DSP library [no]
  --enable-libcaca         enable textual display using libcaca [no]
  --enable-libcelt         enable CELT decoding via libcelt [no]
  --enable-libcdio         enable audio CD grabbing with libcdio [no]
  --enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]
  --enable-libdav1d        enable AV1 decoding via libdav1d [no]
  --enable-libdavs2        enable AVS2 decoding via libdavs2 [no]
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
                           and libraw1394 [no]
  --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
  --enable-libflite        enable flite (voice synthesis) support via libflite [no]
  --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
  --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
  --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
  --enable-libglslang      enable GLSL->SPIRV compilation via libglslang [no]
  --enable-libgme          enable Game Music Emu via libgme [no]
  --enable-libgsm          enable GSM de/encoding via libgsm [no]
  --enable-libiec61883     enable iec61883 via libiec61883 [no]
  --enable-libilbc         enable iLBC de/encoding via libilbc [no]
  --enable-libjack         enable JACK audio sound server [no]
  --enable-libklvanc       enable Kernel Labs VANC processing [no]
  --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
  --enable-liblensfun      enable lensfun lens correction [no]
  --enable-libmodplug      enable ModPlug via libmodplug [no]
  --enable-libmp3lame      enable MP3 encoding via libmp3lame [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-libopenh264     enable H.264 encoding via OpenH264 [no]
  --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
  --enable-libopenmpt      enable decoding tracked files via libopenmpt [no]
  --enable-libopus         enable Opus de/encoding via libopus [no]
  --enable-libpulse        enable Pulseaudio input via libpulse [no]
  --enable-librabbitmq     enable RabbitMQ library [no]
  --enable-librav1e        enable AV1 encoding via rav1e [no]
  --enable-librsvg         enable SVG rasterization via librsvg [no]
  --enable-librubberband   enable rubberband needed for rubberband filter [no]
  --enable-librtmp         enable RTMP[E] support via librtmp [no]
  --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
  --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
  --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
  --enable-libsoxr         enable Include libsoxr resampling [no]
  --enable-libspeex        enable Speex de/encoding via libspeex [no]
  --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
  --enable-libssh          enable SFTP protocol via libssh [no]
  --enable-libtensorflow   enable TensorFlow as a DNN module backend
                           for DNN based filters like sr [no]
  --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
  --enable-libtheora       enable Theora encoding via libtheora [no]
  --enable-libtls          enable LibreSSL (via libtls), needed for https support
                           if openssl, gnutls or mbedtls is not used [no]
  --enable-libtwolame      enable MP2 encoding via libtwolame [no]
  --enable-libv4l2         enable libv4l2/v4l-utils [no]
  --enable-libvidstab      enable video stabilization using vid.stab [no]
  --enable-libvmaf         enable vmaf filter via libvmaf [no]
  --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
  --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
                           native implementation exists [no]
  --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
  --enable-libwavpack      enable wavpack encoding via libwavpack [no]
  --enable-libwebp         enable WebP encoding via libwebp [no]
  --enable-libx264         enable H.264 encoding via x264 [no]
  --enable-libx265         enable HEVC encoding via x265 [no]
  --enable-libxavs         enable AVS encoding via xavs [no]
  --enable-libxavs2        enable AVS2 encoding via xavs2 [no]
  --enable-libxcb          enable X11 grabbing using XCB [autodetect]
  --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
  --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
  --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
  --enable-libxvid         enable Xvid encoding via xvidcore,
                           native MPEG-4/Xvid encoder exists [no]
  --enable-libxml2         enable XML parsing using the C library libxml2, needed
                           for dash demuxing support [no]
  --enable-libzimg         enable z.lib, needed for zscale filter [no]
  --enable-libzmq          enable message passing via libzmq [no]
  --enable-libzvbi         enable teletext support via libzvbi [no]
  --enable-lv2             enable LV2 audio filtering [no]
  --disable-lzma           disable lzma [autodetect]
  --enable-decklink        enable Blackmagic DeckLink I/O support [no]
  --enable-mbedtls         enable mbedTLS, needed for https support
                           if openssl, gnutls or libtls is not used [no]
  --enable-mediacodec      enable Android MediaCodec support [no]
  --enable-libmysofa       enable libmysofa, needed for sofalizer filter [no]
  --enable-openal          enable OpenAL 1.1 capture support [no]
  --enable-opencl          enable OpenCL processing [no]
  --enable-opengl          enable OpenGL rendering [no]
  --enable-openssl         enable openssl, needed for https support
                           if gnutls, libtls or mbedtls is not used [no]
  --enable-pocketsphinx    enable PocketSphinx, needed for asr filter [no]
  --disable-sndio          disable sndio support [autodetect]
  --disable-schannel       disable SChannel SSP, needed for TLS support on
                           Windows if openssl and gnutls are not used [autodetect]
  --disable-sdl2           disable sdl2 [autodetect]
  --disable-securetransport disable Secure Transport, needed for TLS support
                           on OSX if openssl and gnutls are not used [autodetect]
  --enable-vapoursynth     enable VapourSynth demuxer [no]
  --enable-vulkan          enable Vulkan code [no]
  --disable-xlib           disable xlib [autodetect]
  --disable-zlib           disable zlib [autodetect]

  The following libraries provide various hardware acceleration features:
  --disable-amf            disable AMF video encoding code [autodetect]
  --disable-audiotoolbox   disable Apple AudioToolbox code [autodetect]
  --enable-cuda-nvcc       enable Nvidia CUDA compiler [no]
  --disable-cuda-llvm      disable CUDA compilation using clang [autodetect]
  --disable-cuvid          disable Nvidia CUVID support [autodetect]
  --disable-d3d11va        disable Microsoft Direct3D 11 video acceleration code [autodetect]
  --disable-dxva2          disable Microsoft DirectX 9 video acceleration code [autodetect]
  --disable-ffnvcodec      disable dynamically linked Nvidia code [autodetect]
  --enable-libdrm          enable DRM code (Linux) [no]
  --enable-libmfx          enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no]
  --enable-libnpp          enable Nvidia Performance Primitives-based code [no]
  --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
  --disable-nvdec          disable Nvidia video decoding acceleration (via hwaccel) [autodetect]
  --disable-nvenc          disable Nvidia video encoding code [autodetect]
  --enable-omx             enable OpenMAX IL code [no]
  --enable-omx-rpi         enable OpenMAX IL code for Raspberry Pi [no]
  --enable-rkmpp           enable Rockchip Media Process Platform code [no]
  --disable-v4l2-m2m       disable V4L2 mem2mem code [autodetect]
  --disable-vaapi          disable Video Acceleration API (mainly Unix/Intel) code [autodetect]
  --disable-vdpau          disable Nvidia Video Decode and Presentation API for Unix code [autodetect]
  --disable-videotoolbox   disable VideoToolbox code [autodetect]

Toolchain options:
  --arch=ARCH              select architecture []
  --cpu=CPU                select the minimum required CPU (affects
                           instruction selection, may crash on older CPUs)
  --cross-prefix=PREFIX    use PREFIX for compilation tools []
  --progs-suffix=SUFFIX    program name suffix []
  --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
  --target-samples=DIR     path to samples directory on target
  --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
  --toolchain=NAME         set tool defaults according to NAME
                           (gcc-asan, clang-asan, gcc-msan, clang-msan,
                           gcc-tsan, clang-tsan, gcc-usan, clang-usan,
                           valgrind-massif, valgrind-memcheck,
                           msvc, icl, gcov, llvm-cov, hardened)
  --nm=NM                  use nm tool NM [nm -g]
  --ar=AR                  use archive tool AR [ar]
  --as=AS                  use assembler AS []
  --ln_s=LN_S              use symbolic link tool LN_S [ln -s -f]
  --strip=STRIP            use strip tool STRIP [strip]
  --windres=WINDRES        use windows resource compiler WINDRES [windres]
  --x86asmexe=EXE          use nasm-compatible assembler EXE [nasm]
  --cc=CC                  use C compiler CC [gcc]
  --cxx=CXX                use C compiler CXX [g++]
  --objcc=OCC              use ObjC compiler OCC [gcc]
  --dep-cc=DEPCC           use dependency generator DEPCC [gcc]
  --nvcc=NVCC              use Nvidia CUDA compiler NVCC or clang []
  --ld=LD                  use linker LD []
  --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [pkg-config]
  --pkg-config-flags=FLAGS pass additional flags to pkgconf []
  --ranlib=RANLIB          use ranlib RANLIB [ranlib]
  --doxygen=DOXYGEN        use DOXYGEN to generate API doc [doxygen]
  --host-cc=HOSTCC         use host C compiler HOSTCC
  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
  --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  --host-ld=HOSTLD         use host linker HOSTLD
  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
  --host-extralibs=HLIBS   use libs HLIBS when linking for host
  --host-os=OS             compiler host OS []
  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS []
  --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS []
  --extra-objcflags=FLAGS  add FLAGS to OBJCFLAGS []
  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS []
  --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS []
  --extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS []
  --extra-libs=ELIBS       add ELIBS []
  --extra-version=STRING   version string suffix []
  --optflags=OPTFLAGS      override optimization-related compiler flags
  --nvccflags=NVCCFLAGS    override nvcc flags []
  --build-suffix=SUFFIX    library name suffix []
  --enable-pic             build position-independent code
  --enable-thumb           compile for Thumb instruction set
  --enable-lto             use link-time optimization
  --env="ENV=override"     override the environment variables

Advanced options (experts only):
  --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
  --custom-allocator=NAME  use a supported custom allocator
  --disable-symver         disable symbol versioning
  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  --disable-safe-bitstream-reader
                           disable buffer boundary checking in bitreaders
                           (faster, but may crash)
  --sws-max-filter-size=N  the max filter size swscale uses [256]

Optimization options (experts only):
  --disable-asm            disable all assembly optimizations
  --disable-altivec        disable AltiVec optimizations
  --disable-vsx            disable VSX optimizations
  --disable-power8         disable POWER8 optimizations
  --disable-amd3dnow       disable 3DNow! optimizations
  --disable-amd3dnowext    disable 3DNow! extended optimizations
  --disable-mmx            disable MMX optimizations
  --disable-mmxext         disable MMXEXT optimizations
  --disable-sse            disable SSE optimizations
  --disable-sse2           disable SSE2 optimizations
  --disable-sse3           disable SSE3 optimizations
  --disable-ssse3          disable SSSE3 optimizations
  --disable-sse4           disable SSE4 optimizations
  --disable-sse42          disable SSE4.2 optimizations
  --disable-avx            disable AVX optimizations
  --disable-xop            disable XOP optimizations
  --disable-fma3           disable FMA3 optimizations
  --disable-fma4           disable FMA4 optimizations
  --disable-avx2           disable AVX2 optimizations
  --disable-avx512         disable AVX-512 optimizations
  --disable-aesni          disable AESNI optimizations
  --disable-armv5te        disable armv5te optimizations
  --disable-armv6          disable armv6 optimizations
  --disable-armv6t2        disable armv6t2 optimizations
  --disable-vfp            disable VFP optimizations
  --disable-neon           disable NEON optimizations
  --disable-inline-asm     disable use of inline assembly
  --disable-x86asm         disable use of standalone x86 assembly
  --disable-mipsdsp        disable MIPS DSP ASE R1 optimizations
  --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
  --disable-msa            disable MSA optimizations
  --disable-msa2           disable MSA2 optimizations
  --disable-mipsfpu        disable floating point MIPS optimizations
  --disable-mmi            disable Loongson SIMD optimizations
  --disable-fast-unaligned consider unaligned accesses slow

Developer options (useful when working on FFmpeg itself):
  --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
  --assert-level=level     0(default), 1 or 2, amount of assertion testing,
                           2 causes a slowdown at runtime.
  --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
  --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
  --enable-ftrapv          Trap arithmetic overflows
  --samples=PATH           location of test samples for FATE, if not set use
                           $FATE_SAMPLES at make invocation time.
  --enable-neon-clobber-test check NEON registers for clobbering (should be
                           used only for debugging purposes)
  --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
                           should be used only for debugging purposes)
  --enable-random          randomly enable/disable components
  --disable-random
  --enable-random=LIST     randomly enable/disable specific components or
  --disable-random=LIST    component groups. LIST is a comma-separated list
                           of NAME[:PROB] entries where NAME is a component
                           (group) and PROB the probability associated with
                           NAME (default 0.5).
  --random-seed=VALUE      seed value for --enable/disable-random
  --disable-valgrind-backtrace do not print a backtrace under Valgrind
                           (only applies to --disable-optimizations builds)
  --enable-ossfuzz         Enable building fuzzer tool
  --libfuzzer=PATH         path to libfuzzer
  --ignore-tests=TESTS     comma-separated list (without "fate-" prefix
                           in the name) of tests whose result is ignored
  --enable-linux-perf      enable Linux Performance Monitor API
  --disable-large-tests    disable tests that use a large amount of memory

NOTE: Object files are built at the place where configure is launched.

上面包括了很多配置参数,随着我们对ffmpeg的深入,我们也会慢慢了解这些配置参数,刚开始我们只需要知道我们关心的就好了。

例如我们不记得了禁止编译static怎么写的,我们这样查询一下:

./configure --help | grep static

同样我们可以查询一下share相关的

./configure --help | grep share


这里我设置configure时禁止编译静态库,开启动态库,如下:

执行

./configure --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static

输入上面命令后回车,会等待一段时间,这个时候脚本在查询系统所有匹配的库,如果有不匹配的会有提示,如下图,我的配置会报一个错误:

由于我的电脑没有安装yasm库,所以需要先安装一下:
安装yasm编译器。安装方法如下:

  1. 下载:yasm的下载链接
  2. 解压:把下载下来的压缩包进行解压
  3. 切换路径: cd yasm-1.3.0
  4. 执行配置: ./configure
  5. 编译:make
  6. 安装:make install(提示:Permission denied,就执行sudo make install)

下面我们下来安装yasm编译器 (1)下载:yasm的下载链接 如果上面的链接下载比较慢,可以从我的百度云盘下载: 链接:pan.baidu.com/s/1oGMcX4HY… 密码:m1k2

(3)切换路径:cd yasm-1.3.0

(4)执行配置:./configure

(5)编译:make

(6)安装:make install(提示:Permission denied,就执行sudo make install)

安装了yasm编译器后,我们从新运行一下configure配置:

./configure --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static

如果没有报错,则会打印了下面信息:

 ✘ apple@kongyulu  ~/development/study/ffmpeg/ffmpeg/ffmpeg   master./configure --prefix=/usr/local/ffmpeg --enable-debug=3 --enable-shared --disable-static
install prefix            /usr/local/ffmpeg
source path               .
C compiler                gcc
C library
ARCH                      x86 (generic)
big-endian                no
runtime cpu detection     yes
standalone assembly       yes
x86 assembler             yasm
MMX enabled               yes
MMXEXT enabled            yes
3DNow! enabled            yes
3DNow! extended enabled   yes
SSE enabled               yes
SSSE3 enabled             yes
AESNI enabled             yes
AVX enabled               yes
AVX2 enabled              yes
AVX-512 enabled           yes
XOP enabled               yes
FMA3 enabled              yes
FMA4 enabled              yes
i686 features enabled     yes
CMOV is fast              yes
EBX available             yes
EBP available             yes
debug symbols             yes
strip symbols             yes
optimize for size         no
optimizations             yes
static                    no
shared                    yes
postprocessing support    no
network support           yes
threading support         pthreads
safe bitstream reader     yes
texi2html enabled         no
perl enabled              yes
pod2man enabled           yes
makeinfo enabled          yes
makeinfo supports HTML    no

External libraries:
appkit                  bzlib                   iconv                   securetransport
avfoundation            coreimage               lzma                    zlib

External libraries providing hardware acceleration:
audiotoolbox            videotoolbox

Libraries:
avcodec                 avfilter                avutil                  swscale
avdevice                avformat                swresample

Programs:
ffmpeg                  ffprobe

Enabled decoders:
aac                     cscd                    mp1float                rv40
aac_at                  cyuv                    mp2                     s302m
aac_fixed               dca                     mp2_at                  sami
aac_latm                dds                     mp2float                sanm
aasc                    derf_dpcm               mp3                     sbc
ac3                     dfa                     mp3_at                  scpr
ac3_at                  dirac                   mp3adu                  screenpresso
ac3_fixed               dnxhd                   mp3adufloat             sdx2_dpcm
acelp_kelvin            dolby_e                 mp3float                sgi
adpcm_4xm               dpx                     mp3on4                  sgirle
adpcm_adx               dsd_lsbf                mp3on4float             sheervideo
adpcm_afc               dsd_lsbf_planar         mpc7                    shorten
adpcm_agm               dsd_msbf                mpc8                    sipr
adpcm_aica              dsd_msbf_planar         mpeg1video              siren
adpcm_argo              dsicinaudio             mpeg2video              smackaud
adpcm_ct                dsicinvideo             mpeg4                   smacker
adpcm_dtk               dss_sp                  mpegvideo               smc
adpcm_ea                dst                     mpl2                    smvjpeg
adpcm_ea_maxis_xa       dvaudio                 msa1                    snow
adpcm_ea_r1             dvbsub                  mscc                    sol_dpcm
adpcm_ea_r2             dvdsub                  msmpeg4v1               sonic
adpcm_ea_r3             dvvideo                 msmpeg4v2               sp5x
adpcm_ea_xas            dxa                     msmpeg4v3               speedhq
adpcm_g722              dxtory                  msrle                   srgc
adpcm_g726              dxv                     mss1                    srt
adpcm_g726le            eac3                    mss2                    ssa
adpcm_ima_alp           eac3_at                 msvideo1                stl
adpcm_ima_amv           eacmv                   mszh                    subrip
adpcm_ima_apc           eamad                   mts2                    subviewer
adpcm_ima_apm           eatgq                   mv30                    subviewer1
adpcm_ima_cunning       eatgv                   mvc1                    sunrast
adpcm_ima_dat4          eatqi                   mvc2                    svq1
adpcm_ima_dk3           eightbps                mvdv                    svq3
adpcm_ima_dk4           eightsvx_exp            mvha                    tak
adpcm_ima_ea_eacs       eightsvx_fib            mwsc                    targa
adpcm_ima_ea_sead       escape124               mxpeg                   targa_y216
adpcm_ima_iss           escape130               nellymoser              tdsc
adpcm_ima_mtf           evrc                    nuv                     text
adpcm_ima_oki           exr                     on2avc                  theora
adpcm_ima_qt            ffv1                    opus                    thp
adpcm_ima_qt_at         ffvhuff                 paf_audio               tiertexseqvideo
adpcm_ima_rad           ffwavesynth             paf_video               tiff
adpcm_ima_smjpeg        fic                     pam                     tmv
adpcm_ima_ssi           fits                    pbm                     truehd
adpcm_ima_wav           flac                    pcm_alaw                truemotion1
adpcm_ima_ws            flashsv                 pcm_alaw_at             truemotion2
adpcm_ms                flashsv2                pcm_bluray              truemotion2rt
adpcm_mtaf              flic                    pcm_dvd                 truespeech
adpcm_psx               flv                     pcm_f16le               tscc
adpcm_sbpro_2           fmvc                    pcm_f24le               tscc2
adpcm_sbpro_3           fourxm                  pcm_f32be               tta
adpcm_sbpro_4           fraps                   pcm_f32le               twinvq
adpcm_swf               frwu                    pcm_f64be               txd
adpcm_thp               g2m                     pcm_f64le               ulti
adpcm_thp_le            g723_1                  pcm_lxf                 utvideo
adpcm_vima              g729                    pcm_mulaw               v210
adpcm_xa                gdv                     pcm_mulaw_at            v210x
adpcm_yamaha            gif                     pcm_s16be               v308
adpcm_zork              gremlin_dpcm            pcm_s16be_planar        v408
agm                     gsm                     pcm_s16le               v410
aic                     gsm_ms                  pcm_s16le_planar        vb
alac                    gsm_ms_at               pcm_s24be               vble
alac_at                 h261                    pcm_s24daud             vc1
alias_pix               h263                    pcm_s24le               vc1image
als                     h263i                   pcm_s24le_planar        vcr1
amr_nb_at               h263p                   pcm_s32be               vmdaudio
amrnb                   h264                    pcm_s32le               vmdvideo
amrwb                   hap                     pcm_s32le_planar        vmnc
amv                     hca                     pcm_s64be               vorbis
anm                     hcom                    pcm_s64le               vp3
ansi                    hevc                    pcm_s8                  vp4
ape                     hnm4_video              pcm_s8_planar           vp5
apng                    hq_hqa                  pcm_u16be               vp6
aptx                    hqx                     pcm_u16le               vp6a
aptx_hd                 huffyuv                 pcm_u24be               vp6f
arbc                    hymt                    pcm_u24le               vp7
ass                     iac                     pcm_u32be               vp8
asv1                    idcin                   pcm_u32le               vp9
asv2                    idf                     pcm_u8                  vplayer
atrac1                  iff_ilbm                pcm_vidc                vqa
atrac3                  ilbc                    pcx                     wavpack
atrac3al                ilbc_at                 pgm                     wcmv
atrac3p                 imc                     pgmyuv                  webp
atrac3pal               imm4                    pgssub                  webvtt
atrac9                  imm5                    pictor                  wmalossless
aura                    indeo2                  pixlet                  wmapro
aura2                   indeo3                  pjs                     wmav1
avrn                    indeo4                  png                     wmav2
avrp                    indeo5                  ppm                     wmavoice
avs                     interplay_acm           prores                  wmv1
avui                    interplay_dpcm          prosumer                wmv2
ayuv                    interplay_video         psd                     wmv3
bethsoftvid             jacosub                 ptx                     wmv3image
bfi                     jpeg2000                qcelp                   wnv1
bink                    jpegls                  qdm2                    wrapped_avframe
binkaudio_dct           jv                      qdm2_at                 ws_snd1
binkaudio_rdft          kgv1                    qdmc                    xan_dpcm
bintext                 kmvc                    qdmc_at                 xan_wc3
bitpacked               lagarith                qdraw                   xan_wc4
bmp                     loco                    qpeg                    xbin
bmv_audio               lscr                    qtrle                   xbm
bmv_video               m101                    r10k                    xface
brender_pix             mace3                   r210                    xl
c93                     mace6                   ra_144                  xma1
cavs                    magicyuv                ra_288                  xma2
ccaption                mdec                    ralf                    xpm
cdgraphics              metasound               rasc                    xsub
cdtoons                 microdvd                rawvideo                xwd
cdxl                    mimic                   realtext                y41p
cfhd                    mjpeg                   rl2                     ylc
cinepak                 mjpegb                  roq                     yop
clearvideo              mlp                     roq_dpcm                yuv4
cljr                    mmvideo                 rpza                    zero12v
cllc                    motionpixels            rscc                    zerocodec
comfortnoise            movtext                 rv10                    zlib
cook                    mp1                     rv20                    zmbv
cpia                    mp1_at                  rv30

Enabled encoders:
a64multi                fits                    pcm_mulaw_at            s302m
a64multi5               flac                    pcm_s16be               sbc
aac                     flashsv                 pcm_s16be_planar        sgi
aac_at                  flashsv2                pcm_s16le               snow
ac3                     flv                     pcm_s16le_planar        sonic
ac3_fixed               g723_1                  pcm_s24be               sonic_ls
adpcm_adx               gif                     pcm_s24daud             srt
adpcm_g722              h261                    pcm_s24le               ssa
adpcm_g726              h263                    pcm_s24le_planar        subrip
adpcm_g726le            h263p                   pcm_s32be               sunrast
adpcm_ima_qt            h264_videotoolbox       pcm_s32le               svq1
adpcm_ima_wav           hevc_videotoolbox       pcm_s32le_planar        targa
adpcm_ms                huffyuv                 pcm_s64be               text
adpcm_swf               ilbc_at                 pcm_s64le               tiff
adpcm_yamaha            jpeg2000                pcm_s8                  truehd
alac                    jpegls                  pcm_s8_planar           tta
alac_at                 ljpeg                   pcm_u16be               utvideo
alias_pix               magicyuv                pcm_u16le               v210
amv                     mjpeg                   pcm_u24be               v308
apng                    mlp                     pcm_u24le               v408
aptx                    movtext                 pcm_u32be               v410
aptx_hd                 mp2                     pcm_u32le               vc2
ass                     mp2fixed                pcm_u8                  vorbis
asv1                    mpeg1video              pcm_vidc                wavpack
asv2                    mpeg2video              pcx                     webvtt
avrp                    mpeg4                   pgm                     wmav1
avui                    msmpeg4v2               pgmyuv                  wmav2
ayuv                    msmpeg4v3               png                     wmv1
bmp                     msvideo1                ppm                     wmv2
cinepak                 nellymoser              prores                  wrapped_avframe
cljr                    opus                    prores_aw               xbm
comfortnoise            pam                     prores_ks               xface
dca                     pbm                     qtrle                   xsub
dnxhd                   pcm_alaw                r10k                    xwd
dpx                     pcm_alaw_at             r210                    y41p
dvbsub                  pcm_dvd                 ra_144                  yuv4
dvdsub                  pcm_f32be               rawvideo                zlib
dvvideo                 pcm_f32le               roq                     zmbv
eac3                    pcm_f64be               roq_dpcm
ffv1                    pcm_f64le               rv10
ffvhuff                 pcm_mulaw               rv20

Enabled hwaccels:
h263_videotoolbox       hevc_videotoolbox       mpeg2_videotoolbox
h264_videotoolbox       mpeg1_videotoolbox      mpeg4_videotoolbox

Enabled parsers:
aac                     dpx                     h264                    sbc
aac_latm                dvaudio                 hevc                    sipr
ac3                     dvbsub                  mjpeg                   tak
adx                     dvd_nav                 mlp                     vc1
av1                     dvdsub                  mpeg4video              vorbis
avs2                    flac                    mpegaudio               vp3
bmp                     g723_1                  mpegvideo               vp8
cavsvideo               g729                    opus                    vp9
cook                    gif                     png                     webp
dca                     gsm                     pnm                     xma
dirac                   h261                    rv30
dnxhd                   h263                    rv40

Enabled demuxers:
aa                      filmstrip               lrc                     rpl
aac                     fits                    lvf                     rsd
ac3                     flac                    lxf                     rso
acm                     flic                    m4v                     rtp
act                     flv                     matroska                rtsp
adf                     fourxm                  mgsts                   s337m
adp                     frm                     microdvd                sami
ads                     fsb                     mjpeg                   sap
adx                     fwse                    mjpeg_2000              sbc
aea                     g722                    mlp                     sbg
afc                     g723_1                  mlv                     scc
aiff                    g726                    mm                      sdp
aix                     g726le                  mmf                     sdr2
alp                     g729                    mov                     sds
amr                     gdv                     mp3                     sdx
amrnb                   genh                    mpc                     segafilm
amrwb                   gif                     mpc8                    ser
anm                     gsm                     mpegps                  shorten
apc                     gxf                     mpegts                  siff
ape                     h261                    mpegtsraw               sln
apm                     h263                    mpegvideo               smacker
apng                    h264                    mpjpeg                  smjpeg
aptx                    hca                     mpl2                    smush
aptx_hd                 hcom                    mpsub                   sol
aqtitle                 hevc                    msf                     sox
argo_asf                hls                     msnwc_tcp               spdif
asf                     hnm                     mtaf                    srt
asf_o                   ico                     mtv                     stl
ass                     idcin                   musx                    str
ast                     idf                     mv                      subviewer
au                      iff                     mvi                     subviewer1
av1                     ifv                     mxf                     sup
avi                     ilbc                    mxg                     svag
avr                     image2                  nc                      swf
avs                     image2_alias_pix        nistsphere              tak
avs2                    image2_brender_pix      nsp                     tedcaptions
bethsoftvid             image2pipe              nsv                     thp
bfi                     image_bmp_pipe          nut                     threedostr
bfstm                   image_dds_pipe          nuv                     tiertexseq
bink                    image_dpx_pipe          ogg                     tmv
bintext                 image_exr_pipe          oma                     truehd
bit                     image_gif_pipe          paf                     tta
bmv                     image_j2k_pipe          pcm_alaw                tty
boa                     image_jpeg_pipe         pcm_f32be               txd
brstm                   image_jpegls_pipe       pcm_f32le               ty
c93                     image_pam_pipe          pcm_f64be               v210
caf                     image_pbm_pipe          pcm_f64le               v210x
cavsvideo               image_pcx_pipe          pcm_mulaw               vag
cdg                     image_pgm_pipe          pcm_s16be               vc1
cdxl                    image_pgmyuv_pipe       pcm_s16le               vc1t
cine                    image_pictor_pipe       pcm_s24be               vividas
codec2                  image_png_pipe          pcm_s24le               vivo
codec2raw               image_ppm_pipe          pcm_s32be               vmd
concat                  image_psd_pipe          pcm_s32le               vobsub
data                    image_qdraw_pipe        pcm_s8                  voc
daud                    image_sgi_pipe          pcm_u16be               vpk
dcstr                   image_sunrast_pipe      pcm_u16le               vplayer
derf                    image_svg_pipe          pcm_u24be               vqf
dfa                     image_tiff_pipe         pcm_u24le               w64
dhav                    image_webp_pipe         pcm_u32be               wav
dirac                   image_xpm_pipe          pcm_u32le               wc3
dnxhd                   image_xwd_pipe          pcm_u8                  webm_dash_manifest
dsf                     ingenient               pcm_vidc                webvtt
dsicin                  ipmovie                 pjs                     wsaud
dss                     ircam                   pmp                     wsd
dts                     iss                     pp_bnk                  wsvqa
dtshd                   iv8                     pva                     wtv
dv                      ivf                     pvf                     wv
dvbsub                  ivr                     qcp                     wve
dvbtxt                  jacosub                 r3d                     xa
dxa                     jv                      rawvideo                xbin
ea                      kux                     realtext                xmv
ea_cdata                kvag                    redspark                xvag
eac3                    live_flv                rl2                     xwma
epaf                    lmlm4                   rm                      yop
ffmetadata              loas                    roq                     yuv4mpegpipe

Enabled muxers:
a64                     framemd5                mpeg1video              roq
ac3                     g722                    mpeg2dvd                rso
adts                    g723_1                  mpeg2svcd               rtp
adx                     g726                    mpeg2video              rtp_mpegts
aiff                    g726le                  mpeg2vob                rtsp
amr                     gif                     mpegts                  sap
apng                    gsm                     mpjpeg                  sbc
aptx                    gxf                     mxf                     scc
aptx_hd                 h261                    mxf_d10                 segafilm
asf                     h263                    mxf_opatom              segment
asf_stream              h264                    null                    singlejpeg
ass                     hash                    nut                     smjpeg
ast                     hds                     oga                     smoothstreaming
au                      hevc                    ogg                     sox
avi                     hls                     ogv                     spdif
avm2                    ico                     oma                     spx
avs2                    ilbc                    opus                    srt
bit                     image2                  pcm_alaw                stream_segment
caf                     image2pipe              pcm_f32be               streamhash
cavsvideo               ipod                    pcm_f32le               sup
codec2                  ircam                   pcm_f64be               swf
codec2raw               ismv                    pcm_f64le               tee
crc                     ivf                     pcm_mulaw               tg2
dash                    jacosub                 pcm_s16be               tgp
data                    latm                    pcm_s16le               truehd
daud                    lrc                     pcm_s24be               tta
dirac                   m4v                     pcm_s24le               uncodedframecrc
dnxhd                   matroska                pcm_s32be               vc1
dts                     matroska_audio          pcm_s32le               vc1t
dv                      md5                     pcm_s8                  voc
eac3                    microdvd                pcm_u16be               w64
f4v                     mjpeg                   pcm_u16le               wav
ffmetadata              mkvtimestamp_v2         pcm_u24be               webm
fifo                    mlp                     pcm_u24le               webm_chunk
fifo_test               mmf                     pcm_u32be               webm_dash_manifest
filmstrip               mov                     pcm_u32le               webp
fits                    mp2                     pcm_u8                  webvtt
flac                    mp3                     pcm_vidc                wtv
flv                     mp4                     psp                     wv
framecrc                mpeg1system             rawvideo                yuv4mpegpipe
framehash               mpeg1vcd                rm

Enabled protocols:
async                   gopher                  mmst                    srtp
cache                   hls                     pipe                    subfile
concat                  http                    prompeg                 tcp
crypto                  httpproxy               rtmp                    tee
data                    https                   rtmps                   tls
ffrtmphttp              icecast                 rtmpt                   udp
file                    md5                     rtmpts                  udplite
ftp                     mmsh                    rtp                     unix

Enabled filters:
abench                  bwdif                   haldclutsrc             scroll
abitscope               cas                     hdcd                    select
acompressor             cellauto                headphone               selectivecolor
acontrast               channelmap              hflip                   sendcmd
acopy                   channelsplit            highpass                separatefields
acrossfade              chorus                  highshelf               setdar
acrossover              chromahold              hilbert                 setfield
acrusher                chromakey               histogram               setparams
acue                    chromashift             hqx                     setpts
addroi                  ciescope                hstack                  setrange
adeclick                codecview               hue                     setsar
adeclip                 color                   hwdownload              settb
adelay                  colorbalance            hwmap                   showcqt
aderivative             colorchannelmixer       hwupload                showfreqs
adrawgraph              colorhold               hysteresis              showinfo
aecho                   colorkey                idet                    showpalette
aemphasis               colorlevels             il                      showspatial
aeval                   colorspace              inflate                 showspectrum
aevalsrc                compand                 interleave              showspectrumpic
afade                   compensationdelay       join                    showvolume
afftdn                  concat                  lagfun                  showwaves
afftfilt                convolution             lenscorrection          showwavespic
afifo                   convolve                life                    shuffleframes
afir                    copy                    limiter                 shuffleplanes
afirsrc                 coreimage               loop                    sidechaincompress
aformat                 coreimagesrc            loudnorm                sidechaingate
agate                   crop                    lowpass                 sidedata
agraphmonitor           crossfeed               lowshelf                sierpinski
ahistogram              crystalizer             lumakey                 signalstats
aiir                    cue                     lut                     silencedetect
aintegral               curves                  lut1d                   silenceremove
ainterleave             datascope               lut2                    sinc
alimiter                dcshift                 lut3d                   sine
allpass                 dctdnoiz                lutrgb                  smptebars
allrgb                  deband                  lutyuv                  smptehdbars
allyuv                  deblock                 mandelbrot              sobel
aloop                   decimate                maskedclamp             spectrumsynth
alphaextract            deconvolve              maskedmax               split
alphamerge              dedot                   maskedmerge             sr
amerge                  deesser                 maskedmin               ssim
ametadata               deflate                 maskedthreshold         stereotools
amix                    deflicker               maskfun                 stereowiden
amovie                  dejudder                mcompand                streamselect
amplify                 derain                  median                  superequalizer
amultiply               deshake                 mergeplanes             surround
anequalizer             despill                 mestimate               swaprect
anlmdn                  detelecine              metadata                swapuv
anlms                   dilation                midequalizer            tblend
anoisesrc               displace                minterpolate            telecine
anull                   dnn_processing          mix                     testsrc
anullsink               doubleweave             movie                   testsrc2
anullsrc                drawbox                 negate                  thistogram
apad                    drawgraph               nlmeans                 threshold
aperms                  drawgrid                noformat                thumbnail
aphasemeter             drmeter                 noise                   tile
aphaser                 dynaudnorm              normalize               tlut2
apulsator               earwax                  null                    tmedian
arealtime               ebur128                 nullsink                tmix
aresample               edgedetect              nullsrc                 tonemap
areverse                elbg                    oscilloscope            tpad
arnndn                  entropy                 overlay                 transpose
aselect                 equalizer               pad                     treble
asendcmd                erosion                 pal100bars              tremolo
asetnsamples            extractplanes           pal75bars               trim
asetpts                 extrastereo             palettegen              unpremultiply
asetrate                fade                    paletteuse              unsharp
asettb                  fftdnoiz                pan                     v360
ashowinfo               fftfilt                 perms                   vectorscope
asidedata               field                   photosensitivity        vflip
asoftclip               fieldhint               pixdesctest             vfrdet
asplit                  fieldmatch              pixscope                vibrance
astats                  fieldorder              premultiply             vibrato
astreamselect           fifo                    prewitt                 vignette
asubboost               fillborders             pseudocolor             vmafmotion
atadenoise              firequalizer            psnr                    volume
atempo                  flanger                 qp                      volumedetect
atrim                   floodfill               random                  vstack
avectorscope            format                  readeia608              w3fdif
avgblur                 fps                     readvitc                waveform
axcorrelate             framepack               realtime                weave
bandpass                framerate               remap                   xbr
bandreject              framestep               removegrain             xfade
bass                    freezedetect            removelogo              xmedian
bbox                    freezeframes            replaygain              xstack
bench                   gblur                   reverse                 yadif
bilateral               geq                     rgbashift               yaepblur
biquad                  gradfun                 rgbtestsrc              yuvtestsrc
bitplanenoise           graphmonitor            roberts                 zoompan
blackdetect             greyedge                rotate
blend                   haas                    scale
bm3d                    haldclut                scale2ref

Enabled bsfs:
aac_adtstoasc           filter_units            mjpega_dump_header      prores_metadata
av1_frame_merge         h264_metadata           mov2textsub             remove_extradata
av1_frame_split         h264_mp4toannexb        mp3_header_decompress   text2movsub
av1_metadata            h264_redundant_pps      mpeg2_metadata          trace_headers
chomp                   hapqa_extract           mpeg4_unpack_bframes    truehd_core
dca_core                hevc_metadata           noise                   vp9_metadata
dump_extradata          hevc_mp4toannexb        null                    vp9_raw_reorder
eac3_core               imx_dump_header         opus_metadata           vp9_superframe
extract_extradata       mjpeg2jpeg              pcm_rechunk             vp9_superframe_split

Enabled indevs:
avfoundation            lavfi

Enabled outdevs:

License: LGPL version 2.1 or later
libavutil/avconfig.h is unchanged
libavfilter/filter_list.c is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavdevice/indev_list.c is unchanged
libavdevice/outdev_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged
 apple@kongyulu  ~/development/study/ffmpeg/ffmpeg/ffmpeg   master 

这样我们已经成功配置了FFmpeg,接下来执行编译

  • 执行make -j 4 这里命令的意思是增加4个内核,并行编译,这样提高编译速度 执行make命令后,接下来需要等待比较长的时间等编译完成,需要耐心

增加权限后,就可以安装成功了。

这样就成功安装到了/usr/local/ffmpeg 目录下面了,我们切换到这个目录查看一下

我们可以看到有四个子目录:bin, include, lib, share

  1. bin目录:存放所有ffmpeg的工具库
  2. include目录: 存放ffmpeg库的所有头文件
  3. lib目录:ffmepg生成的动态库或静态库
  4. share目录:存放文档相关内容和一些demo实例


我们接下来可以进入bin目录执行命令:
 

正常会有三个子目录,由于我这里没有安装ffplay所以少了一个ffplay
这是为什么呢?

因为ffplay实际上是客户端ffplay.c的C程序编译出来的,该ffplay.c需要依赖avdevice模块,而avdevice模块使用了sdl的API,如果你的PC上没有sdl(1.x版本,最常用的是1.2.0版本),那么ffplay就会编译不出来了,所以要想编译出命令行工具ffplay,首先的编译基础库 sdl

  • Mac OS 安装sdl 库

如果没有安装brew的话,要先安装Homebrew
 

ruby -e "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/master/install)”

等待一段时间,就安装好了,

然后执行命令:

brew install sdl 

等待下载并且安装完毕之后,重新执行上述FFmpeg的配置和安装步骤,待make install结束之后,再去bin目录下就可以找到命令行工具ffplay了。

  • 安装完成之后接下来一个很重要的事情就是配置环境变量,如果没有配置,你直接执行ffmpeg命令是会报错的

如果你配置环境变量,则需要每次带上全路径,如下:

/usr/local/ffmpeg/bin/ffmpeg -version

接下来配置环境变量

执行命令

vi ~/.bash_profile

在配置文件加入ffmpeg的bin文件夹路径:

export PATH=$PATH:/usr/local/ffmpeg/bin

然后输入:wq保存退出,再执行下面命令让刚配置的环境变量生效:

source ~/.bash_profile

3.2 在Linux下编译安装FFmpeg

3.2.1 apt 命令安装

在ubuntu操作系统上可以很容易的跟Mac电脑上执行brew install ffmpeg一样可以一行命令执行 通过执行apt 安装如下:

sudo apt install ffmpeg

这个的弊端也是无法定制化,如果要定制化还是要手动编译源码安装

安装完成后,我们可以执行ffmpeg -version测试是否安装成功

Centos 操作系统下安装

  • 需安装Nux Dextop Yum 源, 由于CentOS没有官方FFmpeg rpm软件包。但是,我们可以使用第三方YUM源(Nux Dextop)完成此工作。

CentOS 7下:

sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

然后

sudo yum install ffmpeg ffmpeg-devel -y

3.2.2 源码安装

tar -xjvf ffmpeg-4.1.tar.bz2
cd ffmpeg-4.1/

跟上面mac源码安装类似,先进行configure配置,配置过程可能报错,如报下面错误:

[root@kongyulu ffmpeg-4.1]# ./configure 
gcc is unable to create an executable file.
If gcc is a cross-compiler, use the --enable-cross-compile option.
Only do this if you know what cross compiling means.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will   help
solve the problem.

则说明yasm编译器没有安装或者太老了,需要先安装新的yasm汇编器。
可以使用--disable-yasm禁用这个选项编译,yasm是一款汇编器,并且是完全重写了nasm的汇编环境,接收nasm和gas语法,支持x86和amd64指令集,所以这里安装一下yasm即可

  • Linux下安装yasm 跟Mac下安装相似,都是先下载源码,然后配置,编译,安装

官网下载yasm.tortall.net/Download.ht…
下载后解压,安装
 

tar -xvzf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make
make install

安装成功后,还是和mac安装ffmpeg一样,需要重新配置FFmpeg:

./configure --enable-shared --prefix=/opt/ffmpeg

/opt/ffmpeg 是配置的安装目录,可以自己配置路径

  • 然后make进行编译
make

安装

make install

make install会把ffmpeg相关执行程序、头文件、lib库安装在/opt/ffmpeg/

  • 安装完成后可以进入/opt/ffmpeg/查看

发现有bin,include,lib,share这4个目录
bin是ffmpeg主程序二进制目录 include是C/C++头文件目录 lib是编译好的库文件目录 share是文档目录

  • 我们可以进入bin目录执行./ffmpeg -version, 查看当前版本的详细信息 可能会报错:
libavdevice.so.57: cannot open shared object file: No such file or directory

原因是lib目录未加载到链接到系统库中 系统ld目录列表在/etc/ld.so.conf中,打开文件会发现, 里面引用了/etc/ld.so.conf.d/下面所有的.conf文件,比如mariadb-x86_64.conf
解决上面报错,需要创建一个文件并写入lib路径即可

执行命令:vim /etc/ld.so.conf.d/ffmpeg.conf

  1. 然后添加一行内容:/opt/ffmpeg/lib
  2. 之后保存并退出,然后执行 ldconfig使配置生效,
  3. 再次执行./ffmpeg -version 显示就正常了

正常会打印如下信息

[root@kongyulu ffmpeg-4.1]#  ffmpeg -ersion
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
configuration: --enable-shared --prefix=/opt/ffmpeg-4
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100

接下来需要配置环境变量 使用命令vim /etc/profile:编辑写入↓

PATH=/opt/python364/bin/:/opt/ffmpeg-4/bin/:$PATH

然后执行命令source /etc/profile:使修改后的配置文件生效

  • 检测ffmpeg是否安装成功 执行which ffmpeg 查看安装路径

3.3 在Window下编译安装FFmpeg

3.3.1 Window编译工具介绍

window下编译FFmpeg相对复杂一下,需要借助Cygwin或MinGW来编译,可以通过MinGW+ MSYS2 或者 VS+ MSYS2来编译ffmpeg

Cygwin(Cygnus Windows)实际上相当于在window安装了一个软件来模拟linux系统
MinGW(Minimalist GNU for Windows)是完全模仿了linux的编译工具,相对于将linux的编译工具移植到 window,基于window系统api进行编译,需要提供额外的工具配合使用
VS就是 window开发很熟悉了
MSYS2(Minimal SYStem 2)

3.3.2 Window如何编译ffmpeg
Window编译ffmpeg主要有下面三种方式

  • Cygwin直接安装使用: Cygwin编译跟linux编译一模一样的,Cygwin完全就像一个虚拟机模拟了linux操作系统。Cygwin实际上是做了一层linux的api到windows 的api的转换。

但是这样编译出来的ffmpeg的exe程序需要挂在一个Cygwin.dll库才可以运行,因为它有一层转换,所以性能对比原始的window程序有一些损耗。
 

  • MinGW + MSYS2 : 官方推荐的方式,这种编译出来的就是原生的window程序,不需要和Cygwin一样需要加载一个动态库了。

它的编译方式实际上和linux是一致的

  • VS + MSYS2: 这种就是采用类linux的编译,只是把里面的工具链换成了VS的工具,但是这种方式生成ffplay比较麻烦。

所以一般都选择MinGW + MSYS2 : 官方推荐的方式

3.3.2.1 Cygwin 编译FFmpeg

在windows下安装 ffmpeg 的最好方式就是使用 Cygwin 。 Cygwin 是什么呢?简单的说,就是在 Windows上装了一个Linux模拟器。然后你可以在这个模拟器上按照Linux的方式操作 Windows系统。因此,Windows安装了 Cygwin 之后,你就把它当Linux用就可以了。
首先,到 Cygwin 官网下载 Cygwin 的可执行程序 setup-x86_64.exe。当然,它是 64位的,如果你现在还在用 32位的,那请在 Cygwin官网上找 32位对应的版本。

  • 首先要安装Cygwin

下载软件后开始安装

选择系统的网络连接方式,跟虚拟机类似

选择镜像安装

选择镜像的对应包

然后选择我们需要的安装包安装,我这里选择 Debug, Devel这两个必须的

此外还需要选择网络

还需要添加wget

此外我们选择一个sdl的库

为了后面编译出ffplay库,最好把下面的红框里面都选上

以上就是一个最小的安装了

需要确保安装了下面这些工具

  1. gcc
  2. g++
  3. make
  4. cmake
  5. automake
  6. gdb
  7. nasm
  8. yasm
  9. wget

选好之后继续下一步

等待安装完成

然后点击图标打开

可以看到一个linux的控制台,如果在window下学习linux命名,就可以在这个控制台练习

这样你就可以敲入linux命令了

如果我们要访问window下的D:盘,可以像下面这样访问:

  • 然后要安装apt-cyg: 这个实际就是Cygwin下的apt工具

apt-cyg与 Ubuntu系统中的 apt一样特别好用,而且使用的方式与 apt也是一个样子的。

我们可以在Cygwin下执行下面的命令就好了

wget -c https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg

然后执行命令

install apt-cyg /bin

安装好apt-cyg后,就可以用 apt-cyg instal xxx这样来安装了我们的包了跟Mac下使用brew install xxx一样爽歪歪。

接下来安装pkg-config工具 在Windows系统下,一般不会默认安装该工具,所以在Windows下做实验的同学大都会遇到明明已经装了某个库,但仍然找不到该库的情况。其原因就是没有安装 pkg-config这个工具。 首先确认是否已经将 pkg-config工具安装好了。可以执行下面的命令:
 

pkg-config

如果提示没有安装,则先将该工具安装好,安装命令如下:

apt-cyg install pkg-config

然后就是安装了,安装方式跟mac,linux一样

  1. 输入命令:./configure --prefix=/usr/local/ffmpeg 配置环境
  2. 执行命令:make -j 4 编译源码
  3. 执行命令:make install 安装


下载源码通过http直接下载或者git下载
 

这里我使用git方式,先创建一个ffmpeg目录,然后Git clone代码

下载好源码后,进入目录,然后配置configure

配置完成报告如下:

此时make文件已经生成好了,我们输入make -j 4执行编译

这个编译过程比较长,耐心等待

最好执行make install 安装

安装好之后,我们可以进入/usr/local/ffmpeg目录查看

我们可以看到四个目录:bin,include,lib,share接下来,我们进入bin目录:

可以看到三个exe文件,ffmpeg.exe, ffplayer.exe, ffprobe.exe

我们可以执行ffmpeg.exe

  • 接下来也需要配置环境变量,不然每次要带全路径

输入命令:vi ~/.bashrc 编辑配置文件

按快捷键“Shift+G”跳到文件末尾,在配置文件末尾插入:export PATH=/usr/local/ffmpeg/bin:$PATH

然后按esc键,退出编辑模式,输入:wq 保存退出

然后,我们输入source ~/.bashrc使配置文件生效

最好我们输入env | grep PATH来测试配置文件是否生效

配置好环境变量后,我们直接输入ffmpeg.exe就可以找到了

3.3.2.1.2 x264 安装

虽然有了apt-cyg这个神器,但它目前只能安装Linux下的一些常用命令,像我们编译时需要的 x264, x265这些库它是无法找到的。

所以这些库需要我们自己来编译

  • 编译yasm
  1. 下载源码:wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
  2. 解压:tar zxvf yasm-1.3.0.tar.gz
  3. 切换到目录:cd yasm-1.3.0
  4. 配置选项:./configure
  5. 编译安装:make && sudo make install
  • 编译fdk-aac
  1. 下载源码:wget https://jaist.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.6.tar.gz
  2. 解压:tar xvf fdk-aac-0.1.6.tar.gz
  3. 切换到目录: cd fdk-aac-0.1.6
  4. 配置选项:./configure
  5. 编译安装:make && sudo make install
  • 安装lame
  1. 下载源码:wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
  2. 解压:tar -xzf lame-3.99.5.tar.gz
  3. 切换到目录:cd lame-3.99.5
  4. 配置选项:./configure
  5. 编译安装:make && sudo make install


注:编译lame可能遇到的问题:

  1. 问题一: 在Cygwin下安装 lame的时候遇到执行 ./configure 失败的情况。如 "error: cannot guess build type; you must sepcify one",对这个问题可以通过下面的步骤来解决: 安装automake。可以通过 which automake来确认automake 是否已经安装。如果没有安装,可以通使用 apt-cyg install automake进行安装。 确认automake当前版本。可执行automake --version获取当前automake的版本号。 将 lame目录下的 config.guess文件替换为 /usr/share/automake-version下的config.guess 文件。 此时,再执行./configure进就可以下成功了。
  2. 问题二: make时出现 "error: '_O_BINARY' undeclared (first use in this function)"的错误,解决办法如下: 打开出错文件 vi ./frontend/lametime.c 将下面这段代码注释掉 /* #elif defined __CYGWIN setmod(fileno(fp), _O_BINARY); */ 再执行make就可以成功了。
  • 安装nasm
  1. 下载源码:wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz
  2. 解压:tar xvf nasm-2.13.03.tar.gz
  3. 切换到目录:cd nasm-2.13.03
  4. 配置选项:./configure
  5. 编译安装:make && sudo make install
  • 安装x264
  1. 下载源码: wget mirror.yandex.ru/mirrors/ftp… bunzip2 last_x264.tar.bz2
  2. 解压:tar -vxf last_x264.tar
  3. 切换到目录:cd last_x264
  4. 配置选项:./configure --enable-static --enable-shared --disable-asm --disable-avs
  5. 编译安装: make && sudo make install
  • 安装ffmpeg
  1. 下载源码:wget -c https://ffmpeg.org/releases/ffmpeg-4.0.2.tar.bz2
  2. 解压:bunzip2 ffmpeg-4.0.2.tar.bz2
  3. 切换到目录:cd ffmpeg-4.0.2
  4. 配置选项:./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-small --arch=x86_64 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-shared
  5. 编译安装:make && sudo make install

FFmpeg编译的问题:

  1. 问题一:找不到 fdk-aac库 在编译ffmpeg时,有可能会报找不到fdk_aac库的错误。此时我们应该设置一下 PKG_CONFIG_PATH,指定ffmpeg到哪里找我们安装好的库。 上面通过源码安装的库,默认地址为/usr/local/lib下面,当然你可以通过./configure 中的–prefix参数改变这个目录。 如果使用默认路径的话,可以通过下面的命令来指定编译时去哪里找库export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig 如果你改变了默认路径,则将后面的 /usr/local/lib/pkgconfig修改为你变更后的路径/xxx/.../lib/pkgconfig即可。

3.3.2.2 MinGW + MSYS2 编译FFmpeg

3.3.2.3 VS + MSYS2 编译FFmpeg

参考:李超大神的博客和视频:www.imooc.com/article/247…

原文 链接:https://juejin.cn/post/6844904160739999757

★文末名片可以免费领取音视频开发学习资料,内容包括(FFmpeg ,webRTC ,rtmp ,hls ,rtsp ,ffplay ,srs)以及音视频学习路线图等等。

见下方!↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

猜你喜欢

转载自blog.csdn.net/yinshipin007/article/details/131264648
今日推荐