龙空技术网

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

音视频流媒体技术 12

前言:

现在各位老铁们对“centosg编译参数”大概比较关怀,你们都想要了解一些“centosg编译参数”的相关知识。那么小编也在网络上收集了一些关于“centosg编译参数””的相关文章,希望看官们能喜欢,我们快快来了解一下吧!

2. FFmpeg源码下载

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

打开官网如下:

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

3. FFmpeg编译,安装

3.1 在Mac下编译安装FFmpeg

3.1.1 brew 方式安装

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

我们可以先输入brew search ffmpeg

3.1.2 源码编译 方式安装

首先需要下载ffmpeg, 从官网下载

然后是编译ffmpeg 只需要执行下面3条命令即可:

./configure -prefix=/usr/local/ffmpeg -enable-debug=3make -j 4make 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 filtersStandard 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 targetsLicensing 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 buildDocumentation 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 pagesComponent 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 libavutilIndividual 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 filtersExternal 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 variablesAdvanced 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 slowDeveloper 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 memoryNOTE: 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编译器。安装方法如下:

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

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

相关学习资料推荐,点击下方链接免费报名,先码住不迷路~】

音视频免费学习地址:FFmpeg/WebRTC/RTMP/NDK/Android音视频流媒体高级开发

【免费分享】音视频学习资料包、大厂面试题、技术视频和学习路线图,资料包括(C/C++,Linux,FFmpeg webRTC rtmp hls rtsp ffplay srs 等等)有需要的可以点击788280672加群免费领取~

(2) 解压,这里需要用到本篇博客开篇的准备知识的解压命令tar -zxvf yasm-1.3.0.tar

tar -zxvf yasm-1.3.0.tar 

(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-staticinstall prefix            /usr/local/ffmpegsource path               .C compiler                gccC libraryARCH                      x86 (generic)big-endian                noruntime cpu detection     yesstandalone assembly       yesx86 assembler             yasmMMX enabled               yesMMXEXT enabled            yes3DNow! enabled            yes3DNow! extended enabled   yesSSE enabled               yesSSSE3 enabled             yesAESNI enabled             yesAVX enabled               yesAVX2 enabled              yesAVX-512 enabled           yesXOP enabled               yesFMA3 enabled              yesFMA4 enabled              yesi686 features enabled     yesCMOV is fast              yesEBX available             yesEBP available             yesdebug symbols             yesstrip symbols             yesoptimize for size         nooptimizations             yesstatic                    noshared                    yespostprocessing support    nonetwork support           yesthreading support         pthreadssafe bitstream reader     yestexi2html enabled         noperl enabled              yespod2man enabled           yesmakeinfo enabled          yesmakeinfo supports HTML    noExternal libraries:appkit                  bzlib                   iconv                   securetransportavfoundation            coreimage               lzma                    zlibExternal libraries providing hardware acceleration:audiotoolbox            videotoolboxLibraries:avcodec                 avfilter                avutil                  swscaleavdevice                avformat                swresamplePrograms:ffmpeg                  ffprobeEnabled decoders:aac                     cscd                    mp1float                rv40aac_at                  cyuv                    mp2                     s302maac_fixed               dca                     mp2_at                  samiaac_latm                dds                     mp2float                sanmaasc                    derf_dpcm               mp3                     sbcac3                     dfa                     mp3_at                  scprac3_at                  dirac                   mp3adu                  screenpressoac3_fixed               dnxhd                   mp3adufloat             sdx2_dpcmacelp_kelvin            dolby_e                 mp3float                sgiadpcm_4xm               dpx                     mp3on4                  sgirleadpcm_adx               dsd_lsbf                mp3on4float             sheervideoadpcm_afc               dsd_lsbf_planar         mpc7                    shortenadpcm_agm               dsd_msbf                mpc8                    sipradpcm_aica              dsd_msbf_planar         mpeg1video              sirenadpcm_argo              dsicinaudio             mpeg2video              smackaudadpcm_ct                dsicinvideo             mpeg4                   smackeradpcm_dtk               dss_sp                  mpegvideo               smcadpcm_ea                dst                     mpl2                    smvjpegadpcm_ea_maxis_xa       dvaudio                 msa1                    snowadpcm_ea_r1             dvbsub                  mscc                    sol_dpcmadpcm_ea_r2             dvdsub                  msmpeg4v1               sonicadpcm_ea_r3             dvvideo                 msmpeg4v2               sp5xadpcm_ea_xas            dxa                     msmpeg4v3               speedhqadpcm_g722              dxtory                  msrle                   srgcadpcm_g726              dxv                     mss1                    srtadpcm_g726le            eac3                    mss2                    ssaadpcm_ima_alp           eac3_at                 msvideo1                stladpcm_ima_amv           eacmv                   mszh                    subripadpcm_ima_apc           eamad                   mts2                    subvieweradpcm_ima_apm           eatgq                   mv30                    subviewer1adpcm_ima_cunning       eatgv                   mvc1                    sunrastadpcm_ima_dat4          eatqi                   mvc2                    svq1adpcm_ima_dk3           eightbps                mvdv                    svq3adpcm_ima_dk4           eightsvx_exp            mvha                    takadpcm_ima_ea_eacs       eightsvx_fib            mwsc                    targaadpcm_ima_ea_sead       escape124               mxpeg                   targa_y216adpcm_ima_iss           escape130               nellymoser              tdscadpcm_ima_mtf           evrc                    nuv                     textadpcm_ima_oki           exr                     on2avc                  theoraadpcm_ima_qt            ffv1                    opus                    thpadpcm_ima_qt_at         ffvhuff                 paf_audio               tiertexseqvideoadpcm_ima_rad           ffwavesynth             paf_video               tiffadpcm_ima_smjpeg        fic                     pam                     tmvadpcm_ima_ssi           fits                    pbm                     truehdadpcm_ima_wav           flac                    pcm_alaw                truemotion1adpcm_ima_ws            flashsv                 pcm_alaw_at             truemotion2adpcm_ms                flashsv2                pcm_bluray              truemotion2rtadpcm_mtaf              flic                    pcm_dvd                 truespeechadpcm_psx               flv                     pcm_f16le               tsccadpcm_sbpro_2           fmvc                    pcm_f24le               tscc2adpcm_sbpro_3           fourxm                  pcm_f32be               ttaadpcm_sbpro_4           fraps                   pcm_f32le               twinvqadpcm_swf               frwu                    pcm_f64be               txdadpcm_thp               g2m                     pcm_f64le               ultiadpcm_thp_le            g723_1                  pcm_lxf                 utvideoadpcm_vima              g729                    pcm_mulaw               v210adpcm_xa                gdv                     pcm_mulaw_at            v210xadpcm_yamaha            gif                     pcm_s16be               v308adpcm_zork              gremlin_dpcm            pcm_s16be_planar        v408agm                     gsm                     pcm_s16le               v410aic                     gsm_ms                  pcm_s16le_planar        vbalac                    gsm_ms_at               pcm_s24be               vblealac_at                 h261                    pcm_s24daud             vc1alias_pix               h263                    pcm_s24le               vc1imageals                     h263i                   pcm_s24le_planar        vcr1amr_nb_at               h263p                   pcm_s32be               vmdaudioamrnb                   h264                    pcm_s32le               vmdvideoamrwb                   hap                     pcm_s32le_planar        vmncamv                     hca                     pcm_s64be               vorbisanm                     hcom                    pcm_s64le               vp3ansi                    hevc                    pcm_s8                  vp4ape                     hnm4_video              pcm_s8_planar           vp5apng                    hq_hqa                  pcm_u16be               vp6aptx                    hqx                     pcm_u16le               vp6aaptx_hd                 huffyuv                 pcm_u24be               vp6farbc                    hymt                    pcm_u24le               vp7ass                     iac                     pcm_u32be               vp8asv1                    idcin                   pcm_u32le               vp9asv2                    idf                     pcm_u8                  vplayeratrac1                  iff_ilbm                pcm_vidc                vqaatrac3                  ilbc                    pcx                     wavpackatrac3al                ilbc_at                 pgm                     wcmvatrac3p                 imc                     pgmyuv                  webpatrac3pal               imm4                    pgssub                  webvttatrac9                  imm5                    pictor                  wmalosslessaura                    indeo2                  pixlet                  wmaproaura2                   indeo3                  pjs                     wmav1avrn                    indeo4                  png                     wmav2avrp                    indeo5                  ppm                     wmavoiceavs                     interplay_acm           prores                  wmv1avui                    interplay_dpcm          prosumer                wmv2ayuv                    interplay_video         psd                     wmv3bethsoftvid             jacosub                 ptx                     wmv3imagebfi                     jpeg2000                qcelp                   wnv1bink                    jpegls                  qdm2                    wrapped_avframebinkaudio_dct           jv                      qdm2_at                 ws_snd1binkaudio_rdft          kgv1                    qdmc                    xan_dpcmbintext                 kmvc                    qdmc_at                 xan_wc3bitpacked               lagarith                qdraw                   xan_wc4bmp                     loco                    qpeg                    xbinbmv_audio               lscr                    qtrle                   xbmbmv_video               m101                    r10k                    xfacebrender_pix             mace3                   r210                    xlc93                     mace6                   ra_144                  xma1cavs                    magicyuv                ra_288                  xma2ccaption                mdec                    ralf                    xpmcdgraphics              metasound               rasc                    xsubcdtoons                 microdvd                rawvideo                xwdcdxl                    mimic                   realtext                y41pcfhd                    mjpeg                   rl2                     ylccinepak                 mjpegb                  roq                     yopclearvideo              mlp                     roq_dpcm                yuv4cljr                    mmvideo                 rpza                    zero12vcllc                    motionpixels            rscc                    zerocodeccomfortnoise            movtext                 rv10                    zlibcook                    mp1                     rv20                    zmbvcpia                    mp1_at                  rv30Enabled encoders:a64multi                fits                    pcm_mulaw_at            s302ma64multi5               flac                    pcm_s16be               sbcaac                     flashsv                 pcm_s16be_planar        sgiaac_at                  flashsv2                pcm_s16le               snowac3                     flv                     pcm_s16le_planar        sonicac3_fixed               g723_1                  pcm_s24be               sonic_lsadpcm_adx               gif                     pcm_s24daud             srtadpcm_g722              h261                    pcm_s24le               ssaadpcm_g726              h263                    pcm_s24le_planar        subripadpcm_g726le            h263p                   pcm_s32be               sunrastadpcm_ima_qt            h264_videotoolbox       pcm_s32le               svq1adpcm_ima_wav           hevc_videotoolbox       pcm_s32le_planar        targaadpcm_ms                huffyuv                 pcm_s64be               textadpcm_swf               ilbc_at                 pcm_s64le               tiffadpcm_yamaha            jpeg2000                pcm_s8                  truehdalac                    jpegls                  pcm_s8_planar           ttaalac_at                 ljpeg                   pcm_u16be               utvideoalias_pix               magicyuv                pcm_u16le               v210amv                     mjpeg                   pcm_u24be               v308apng                    mlp                     pcm_u24le               v408aptx                    movtext                 pcm_u32be               v410aptx_hd                 mp2                     pcm_u32le               vc2ass                     mp2fixed                pcm_u8                  vorbisasv1                    mpeg1video              pcm_vidc                wavpackasv2                    mpeg2video              pcx                     webvttavrp                    mpeg4                   pgm                     wmav1avui                    msmpeg4v2               pgmyuv                  wmav2ayuv                    msmpeg4v3               png                     wmv1bmp                     msvideo1                ppm                     wmv2cinepak                 nellymoser              prores                  wrapped_avframecljr                    opus                    prores_aw               xbmcomfortnoise            pam                     prores_ks               xfacedca                     pbm                     qtrle                   xsubdnxhd                   pcm_alaw                r10k                    xwddpx                     pcm_alaw_at             r210                    y41pdvbsub                  pcm_dvd                 ra_144                  yuv4dvdsub                  pcm_f32be               rawvideo                zlibdvvideo                 pcm_f32le               roq                     zmbveac3                    pcm_f64be               roq_dpcmffv1                    pcm_f64le               rv10ffvhuff                 pcm_mulaw               rv20Enabled hwaccels:h263_videotoolbox       hevc_videotoolbox       mpeg2_videotoolboxh264_videotoolbox       mpeg1_videotoolbox      mpeg4_videotoolboxEnabled parsers:aac                     dpx                     h264                    sbcaac_latm                dvaudio                 hevc                    siprac3                     dvbsub                  mjpeg                   takadx                     dvd_nav                 mlp                     vc1av1                     dvdsub                  mpeg4video              vorbisavs2                    flac                    mpegaudio               vp3bmp                     g723_1                  mpegvideo               vp8cavsvideo               g729                    opus                    vp9cook                    gif                     png                     webpdca                     gsm                     pnm                     xmadirac                   h261                    rv30dnxhd                   h263                    rv40Enabled demuxers:aa                      filmstrip               lrc                     rplaac                     fits                    lvf                     rsdac3                     flac                    lxf                     rsoacm                     flic                    m4v                     rtpact                     flv                     matroska                rtspadf                     fourxm                  mgsts                   s337madp                     frm                     microdvd                samiads                     fsb                     mjpeg                   sapadx                     fwse                    mjpeg_2000              sbcaea                     g722                    mlp                     sbgafc                     g723_1                  mlv                     sccaiff                    g726                    mm                      sdpaix                     g726le                  mmf                     sdr2alp                     g729                    mov                     sdsamr                     gdv                     mp3                     sdxamrnb                   genh                    mpc                     segafilmamrwb                   gif                     mpc8                    seranm                     gsm                     mpegps                  shortenapc                     gxf                     mpegts                  siffape                     h261                    mpegtsraw               slnapm                     h263                    mpegvideo               smackerapng                    h264                    mpjpeg                  smjpegaptx                    hca                     mpl2                    smushaptx_hd                 hcom                    mpsub                   solaqtitle                 hevc                    msf                     soxargo_asf                hls                     msnwc_tcp               spdifasf                     hnm                     mtaf                    srtasf_o                   ico                     mtv                     stlass                     idcin                   musx                    strast                     idf                     mv                      subviewerau                      iff                     mvi                     subviewer1av1                     ifv                     mxf                     supavi                     ilbc                    mxg                     svagavr                     image2                  nc                      swfavs                     image2_alias_pix        nistsphere              takavs2                    image2_brender_pix      nsp                     tedcaptionsbethsoftvid             image2pipe              nsv                     thpbfi                     image_bmp_pipe          nut                     threedostrbfstm                   image_dds_pipe          nuv                     tiertexseqbink                    image_dpx_pipe          ogg                     tmvbintext                 image_exr_pipe          oma                     truehdbit                     image_gif_pipe          paf                     ttabmv                     image_j2k_pipe          pcm_alaw                ttyboa                     image_jpeg_pipe         pcm_f32be               txdbrstm                   image_jpegls_pipe       pcm_f32le               tyc93                     image_pam_pipe          pcm_f64be               v210caf                     image_pbm_pipe          pcm_f64le               v210xcavsvideo               image_pcx_pipe          pcm_mulaw               vagcdg                     image_pgm_pipe          pcm_s16be               vc1cdxl                    image_pgmyuv_pipe       pcm_s16le               vc1tcine                    image_pictor_pipe       pcm_s24be               vividascodec2                  image_png_pipe          pcm_s24le               vivocodec2raw               image_ppm_pipe          pcm_s32be               vmdconcat                  image_psd_pipe          pcm_s32le               vobsubdata                    image_qdraw_pipe        pcm_s8                  vocdaud                    image_sgi_pipe          pcm_u16be               vpkdcstr                   image_sunrast_pipe      pcm_u16le               vplayerderf                    image_svg_pipe          pcm_u24be               vqfdfa                     image_tiff_pipe         pcm_u24le               w64dhav                    image_webp_pipe         pcm_u32be               wavdirac                   image_xpm_pipe          pcm_u32le               wc3dnxhd                   image_xwd_pipe          pcm_u8                  webm_dash_manifestdsf                     ingenient               pcm_vidc                webvttdsicin                  ipmovie                 pjs                     wsauddss                     ircam                   pmp                     wsddts                     iss                     pp_bnk                  wsvqadtshd                   iv8                     pva                     wtvdv                      ivf                     pvf                     wvdvbsub                  ivr                     qcp                     wvedvbtxt                  jacosub                 r3d                     xadxa                     jv                      rawvideo                xbinea                      kux                     realtext                xmvea_cdata                kvag                    redspark                xvageac3                    live_flv                rl2                     xwmaepaf                    lmlm4                   rm                      yopffmetadata              loas                    roq                     yuv4mpegpipeEnabled muxers:a64                     framemd5                mpeg1video              roqac3                     g722                    mpeg2dvd                rsoadts                    g723_1                  mpeg2svcd               rtpadx                     g726                    mpeg2video              rtp_mpegtsaiff                    g726le                  mpeg2vob                rtspamr                     gif                     mpegts                  sapapng                    gsm                     mpjpeg                  sbcaptx                    gxf                     mxf                     sccaptx_hd                 h261                    mxf_d10                 segafilmasf                     h263                    mxf_opatom              segmentasf_stream              h264                    null                    singlejpegass                     hash                    nut                     smjpegast                     hds                     oga                     smoothstreamingau                      hevc                    ogg                     soxavi                     hls                     ogv                     spdifavm2                    ico                     oma                     spxavs2                    ilbc                    opus                    srtbit                     image2                  pcm_alaw                stream_segmentcaf                     image2pipe              pcm_f32be               streamhashcavsvideo               ipod                    pcm_f32le               supcodec2                  ircam                   pcm_f64be               swfcodec2raw               ismv                    pcm_f64le               teecrc                     ivf                     pcm_mulaw               tg2dash                    jacosub                 pcm_s16be               tgpdata                    latm                    pcm_s16le               truehddaud                    lrc                     pcm_s24be               ttadirac                   m4v                     pcm_s24le               uncodedframecrcdnxhd                   matroska                pcm_s32be               vc1dts                     matroska_audio          pcm_s32le               vc1tdv                      md5                     pcm_s8                  voceac3                    microdvd                pcm_u16be               w64f4v                     mjpeg                   pcm_u16le               wavffmetadata              mkvtimestamp_v2         pcm_u24be               webmfifo                    mlp                     pcm_u24le               webm_chunkfifo_test               mmf                     pcm_u32be               webm_dash_manifestfilmstrip               mov                     pcm_u32le               webpfits                    mp2                     pcm_u8                  webvttflac                    mp3                     pcm_vidc                wtvflv                     mp4                     psp                     wvframecrc                mpeg1system             rawvideo                yuv4mpegpipeframehash               mpeg1vcd                rmEnabled protocols:async                   gopher                  mmst                    srtpcache                   hls                     pipe                    subfileconcat                  http                    prompeg                 tcpcrypto                  httpproxy               rtmp                    teedata                    https                   rtmps                   tlsffrtmphttp              icecast                 rtmpt                   udpfile                    md5                     rtmpts                  udpliteftp                     mmsh                    rtp                     unixEnabled filters:abench                  bwdif                   haldclutsrc             scrollabitscope               cas                     hdcd                    selectacompressor             cellauto                headphone               selectivecoloracontrast               channelmap              hflip                   sendcmdacopy                   channelsplit            highpass                separatefieldsacrossfade              chorus                  highshelf               setdaracrossover              chromahold              hilbert                 setfieldacrusher                chromakey               histogram               setparamsacue                    chromashift             hqx                     setptsaddroi                  ciescope                hstack                  setrangeadeclick                codecview               hue                     setsaradeclip                 color                   hwdownload              settbadelay                  colorbalance            hwmap                   showcqtaderivative             colorchannelmixer       hwupload                showfreqsadrawgraph              colorhold               hysteresis              showinfoaecho                   colorkey                idet                    showpaletteaemphasis               colorlevels             il                      showspatialaeval                   colorspace              inflate                 showspectrumaevalsrc                compand                 interleave              showspectrumpicafade                   compensationdelay       join                    showvolumeafftdn                  concat                  lagfun                  showwavesafftfilt                convolution             lenscorrection          showwavespicafifo                   convolve                life                    shuffleframesafir                    copy                    limiter                 shuffleplanesafirsrc                 coreimage               loop                    sidechaincompressaformat                 coreimagesrc            loudnorm                sidechaingateagate                   crop                    lowpass                 sidedataagraphmonitor           crossfeed               lowshelf                sierpinskiahistogram              crystalizer             lumakey                 signalstatsaiir                    cue                     lut                     silencedetectaintegral               curves                  lut1d                   silenceremoveainterleave             datascope               lut2                    sincalimiter                dcshift                 lut3d                   sineallpass                 dctdnoiz                lutrgb                  smptebarsallrgb                  deband                  lutyuv                  smptehdbarsallyuv                  deblock                 mandelbrot              sobelaloop                   decimate                maskedclamp             spectrumsynthalphaextract            deconvolve              maskedmax               splitalphamerge              dedot                   maskedmerge             sramerge                  deesser                 maskedmin               ssimametadata               deflate                 maskedthreshold         stereotoolsamix                    deflicker               maskfun                 stereowidenamovie                  dejudder                mcompand                streamselectamplify                 derain                  median                  superequalizeramultiply               deshake                 mergeplanes             surroundanequalizer             despill                 mestimate               swaprectanlmdn                  detelecine              metadata                swapuvanlms                   dilation                midequalizer            tblendanoisesrc               displace                minterpolate            telecineanull                   dnn_processing          mix                     testsrcanullsink               doubleweave             movie                   testsrc2anullsrc                drawbox                 negate                  thistogramapad                    drawgraph               nlmeans                 thresholdaperms                  drawgrid                noformat                thumbnailaphasemeter             drmeter                 noise                   tileaphaser                 dynaudnorm              normalize               tlut2apulsator               earwax                  null                    tmedianarealtime               ebur128                 nullsink                tmixaresample               edgedetect              nullsrc                 tonemapareverse                elbg                    oscilloscope            tpadarnndn                  entropy                 overlay                 transposeaselect                 equalizer               pad                     trebleasendcmd                erosion                 pal100bars              tremoloasetnsamples            extractplanes           pal75bars               trimasetpts                 extrastereo             palettegen              unpremultiplyasetrate                fade                    paletteuse              unsharpasettb                  fftdnoiz                pan                     v360ashowinfo               fftfilt                 perms                   vectorscopeasidedata               field                   photosensitivity        vflipasoftclip               fieldhint               pixdesctest             vfrdetasplit                  fieldmatch              pixscope                vibranceastats                  fieldorder              premultiply             vibratoastreamselect           fifo                    prewitt                 vignetteasubboost               fillborders             pseudocolor             vmafmotionatadenoise              firequalizer            psnr                    volumeatempo                  flanger                 qp                      volumedetectatrim                   floodfill               random                  vstackavectorscope            format                  readeia608              w3fdifavgblur                 fps                     readvitc                waveformaxcorrelate             framepack               realtime                weavebandpass                framerate               remap                   xbrbandreject              framestep               removegrain             xfadebass                    freezedetect            removelogo              xmedianbbox                    freezeframes            replaygain              xstackbench                   gblur                   reverse                 yadifbilateral               geq                     rgbashift               yaepblurbiquad                  gradfun                 rgbtestsrc              yuvtestsrcbitplanenoise           graphmonitor            roberts                 zoompanblackdetect             greyedge                rotateblend                   haas                    scalebm3d                    haldclut                scale2refEnabled bsfs:aac_adtstoasc           filter_units            mjpega_dump_header      prores_metadataav1_frame_merge         h264_metadata           mov2textsub             remove_extradataav1_frame_split         h264_mp4toannexb        mp3_header_decompress   text2movsubav1_metadata            h264_redundant_pps      mpeg2_metadata          trace_headerschomp                   hapqa_extract           mpeg4_unpack_bframes    truehd_coredca_core                hevc_metadata           noise                   vp9_metadatadump_extradata          hevc_mp4toannexb        null                    vp9_raw_reordereac3_core               imx_dump_header         opus_metadata           vp9_superframeextract_extradata       mjpeg2jpeg              pcm_rechunk             vp9_superframe_splitEnabled indevs:avfoundation            lavfiEnabled outdevs:License: LGPL version 2.1 or laterlibavutil/avconfig.h is unchangedlibavfilter/filter_list.c is unchangedlibavcodec/codec_list.c is unchangedlibavcodec/parser_list.c is unchangedlibavcodec/bsf_list.c is unchangedlibavformat/demuxer_list.c is unchangedlibavformat/muxer_list.c is unchangedlibavdevice/indev_list.c is unchangedlibavdevice/outdev_list.c is unchangedlibavformat/protocol_list.c is unchangedffbuild/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

bin目录:存放所有ffmpeg的工具库include目录: 存放ffmpeg库的所有头文件lib目录:ffmepg生成的动态库或静态库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 \)”

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

然后执行命令:

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下编译安装FFmpeg3.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  rpm -Uvh 

然后

sudo yum install ffmpeg ffmpeg-devel -y
3.2.2 源码安装官网下载:ffmpeg.org/download.ht… 这里下载最新版本解压安装包
tar -xjvf ffmpeg-4.1.tar.bz2cd 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 latestversion from Git.  If the latest version fails, report the problem to theffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.Include the log file "ffbuild/config.log" produced by configure as this will   helpsolve 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.gzcd yasm-1.3.0/./configuremakemake 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

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

正常会打印如下信息

[root@kongyulu ffmpeg-4.1]#  ffmpeg -ersionffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developersbuilt with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)configuration: --enable-shared --prefix=/opt/ffmpeg-4libavutil      56. 22.100 / 56. 22.100libavcodec     58. 35.100 / 58. 35.100libavformat    58. 20.100 / 58. 20.100libavdevice    58.  5.100 / 58.  5.100libavfilter     7. 40.101 /  7. 40.101libswscale      5.  3.100 /  5.  3.100libswresample   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库,最好把下面的红框里面都选上

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

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

gccg++makecmakeautomakegdbnasmyasmwget

选好之后继续下一步

等待安装完成

然后点击图标打开

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

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

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

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

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

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

wget -c 

然后执行命令

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

安装好了上面的工具后,接下来就是下载ffmpeg源码了,从官网:ffmpeg.org/download.ht…

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

输入命令:./configure --prefix=/usr/local/ffmpeg 配置环境执行命令:make -j 4 编译源码执行命令: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下载源码:wget 解压:tar zxvf yasm-1.3.0.tar.gz切换到目录:cd yasm-1.3.0配置选项:./configure编译安装:make && sudo make install编译fdk-aac下载源码:wget 解压:tar xvf fdk-aac-0.1.6.tar.gz切换到目录: cd fdk-aac-0.1.6配置选项:./configure编译安装:make && sudo make install安装lame下载源码:wget 解压:tar -xzf lame-3.99.5.tar.gz切换到目录:cd lame-3.99.5配置选项:./configure编译安装:make && sudo make install

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

问题一: 在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进就可以下成功了。问题二: make时出现 "error: '_O_BINARY' undeclared (first use in this function)"的错误,解决办法如下: 打开出错文件 vi ./frontend/lametime.c 将下面这段代码注释掉 /* #elif defined __CYGWIN setmod(fileno(fp), _O_BINARY); */ 再执行make就可以成功了。安装nasm下载源码:wget 解压:tar xvf nasm-2.13.03.tar.gz切换到目录:cd nasm-2.13.03配置选项:./configure编译安装:make && sudo make install安装x264下载源码: wget mirror.yandex.ru/mirrors/ftp… bunzip2 last_x264.tar.bz2解压:tar -vxf last_x264.tar切换到目录:cd last_x264配置选项:./configure --enable-static --enable-shared --disable-asm --disable-avs编译安装: make && sudo make install安装ffmpeg下载源码:wget -c 解压:bunzip2 ffmpeg-4.0.2.tar.bz2切换到目录:cd ffmpeg-4.0.2配置选项:./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编译安装:make && sudo make install

FFmpeg编译的问题:

问题一:找不到 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 编译FFmpeg3.3.2.3 VS + MSYS2 编译FFmpeg

参考:李超大神的博客和视频:…

原文 链接:

标签: #centosg编译参数 #python编译为静态库 #scrollpicjs #spark在ubuntu安装配置 #ubuntu装broadcom