编译配置
C/C++ 开源库都会提供一个 configure 脚本 , 该脚本的配置非常复杂 , 但一般都提供一个帮助选项 ; 执行 ./configure --help 命令 , 即可查看帮助信息 , 建议先将帮助信息熟悉一遍再进行编译 ;
选项说明 ./configure --help
Usage: configure [options] # 用法 configure 后面跟选项
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] # 日志文件 记录测试并输出到文件[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] # 前缀 以 前缀[/usr/local] 安装
--bindir=DIR install binaries in DIR [PREFIX/bin] #二进制(bin)文件 安装二进制文件到指定目录
--datadir=DIR install data files in DIR [PREFIX/share/ffmpeg] # 数据文件data 在目录[PREFIX/share/ffmpeg]中安装数据文件
--docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg] # 文档(doc) 在目录[PREFIX/share/doc/ffmpeg]中安装文档
--libdir=DIR install libs in DIR [PREFIX/lib] # libs 在目录[PREFIX/lib]中安装libs
--shlibdir=DIR install shared libs in DIR [LIBDIR] # 共享库(shared lib) 在目录[LIBDIR]中安装共享库
--incdir=DIR install includes in DIR [PREFIX/include] # includes 在目录[前缀/包含]中安装包含项
--mandir=DIR install man page in DIR [PREFIX/share/man] # 说明页(man page) 在目录[PREFIX/share/man]中安装手册页
--pkgconfigdir=DIR install pkg-config files in DIR [LIBDIR/pkgconfig] # pkg 配置文件 在目录[LIBDIR/pkgconfig]中安装pkg配置文件
--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) # 使用rpath允许在不属于动态链接器搜索路径的路径中安装库链接程序时使用rpath(小心使用)
--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] # 允许使用GPL代码,生成的LIB和二进制文件将在GPL下[no]
--enable-version3 upgrade (L)GPL to version 3 [no] # 将(L)GPL升级至第3版
--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) # 禁用运行时检测CPU功能(较小的二进制文件)
--enable-gray enable full grayscale support (slower color) # 启用全灰度支持(较慢的颜色)
--disable-swscale-alpha disable alpha channel support in swscale # 禁用swscale中的alpha通道支持
--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 # 禁用ffmpeg生成
--disable-ffplay disable ffplay build # 禁用ffplay构建
--disable-ffprobe disable ffprobe build # 禁用ffprobe生成
# 文档选项
Documentation options:
--disable-doc do not build documentation # 不要构建文档
--disable-htmlpages do not build HTML documentation pages # 不要构建HTML文档页面
--disable-manpages do not build man documentation pages # 不要构建man文档页面
--disable-podpages do not build POD documentation pages # 不要构建POD文档页面
--disable-txtpages do not build text documentation pages # 不要构建文本文档页面
# 组件选项
Component options:
--disable-avdevice disable libavdevice build # 禁用libavdevice生成
--disable-avcodec disable libavcodec build # 禁用libavcodec生成
--disable-avformat disable libavformat build # 禁用libavformat生成
--disable-swresample disable libswresample build # 禁用libswresample生成
--disable-swscale disable libswscale build # 禁用libswscale生成
--disable-postproc disable libpostproc build # 禁用libpostproc生成
--disable-avfilter disable libavfilter build # 禁用libavfilter生成
--disable-pthreads disable pthreads [autodetect] # 禁用pthreads[自动检测]
--disable-w32threads disable Win32 threads [autodetect] # 禁用Win32线程[自动检测]
--disable-os2threads disable OS/2 threads [autodetect] # 禁用OS/2线程[自动检测]
--disable-network disable network support [no] # 禁用网络支持[否]
--disable-dct disable DCT code # 禁用DCT代码
--disable-dwt disable DWT code # 禁用DWT代码
--disable-error-resilience disable error resilience code # 禁用错误恢复代码
--disable-lsp disable LSP code # 禁用LSP代码
--disable-lzo disable LZO decoder code # 禁用LZO解码器代码
--disable-mdct disable MDCT code # 禁用MDCT代码
--disable-rdft disable RDFT code # 禁用RDFT代码
--disable-fft disable FFT code # 禁用FFT代码
--disable-faan disable floating point AAN (I)DCT code # 禁用浮点AAN(I)DCT代码
--disable-pixelutils disable pixel utils in libavutil # 禁用libavutil中的像素utils
# 单个组件选项
Individual component options:
--disable-everything disable all components listed below # 禁用下面列出的所有组件
--disable-encoder=NAME disable encoder NAME # 禁用(NAME)编码器
--enable-encoder=NAME enable encoder NAME # 启用(NAME)编码器
--disable-encoders disable all encoders # 禁用所有编码器
--disable-decoder=NAME disable decoder NAME # 禁用(NAME)解码器
--enable-decoder=NAME enable decoder NAME # 启用(NAME)解码器
--disable-decoders disable all decoders # 禁用所有解码器
--disable-hwaccel=NAME disable hwaccel NAME # 禁用(NAME)hwaccel
--enable-hwaccel=NAME enable hwaccel NAME # 启用(NAME)hwaccel
--disable-hwaccels disable all hwaccels # 禁用所有hwaccel
--disable-muxer=NAME disable muxer NAME # 禁用(NAME)muxer
--enable-muxer=NAME enable muxer NAME # 启用(NAME)muxer
--disable-muxers disable all muxers # 禁用所有muxers
--disable-demuxer=NAME disable demuxer NAME # 禁用(NAME)解复用器
--enable-demuxer=NAME enable demuxer NAME # 启用(NAME)解复用器
--disable-demuxers disable all demuxers # 禁用所有解复用器
--enable-parser=NAME enable parser NAME # 启用(NAME)解析器
--disable-parser=NAME disable parser NAME # 禁用(NAME)解析器
--disable-parsers disable all parsers # 禁用所有解析器
--enable-bsf=NAME enable bitstream filter NAME # 启用(NAME)位流过滤器
--disable-bsf=NAME disable bitstream filter NAME # 禁用(NAME)位流过滤器
--disable-bsfs disable all bitstream filters # 禁用所有位流过滤器
--enable-protocol=NAME enable protocol NAME # 启用(NAME)协议
--disable-protocol=NAME disable protocol NAME # 禁用(NAME)协议
--disable-protocols disable all protocols # 禁用所有协议
--enable-indev=NAME enable input device NAME # 启用(NAME)输入设备
--disable-indev=NAME disable input device NAME # 禁用(NAME)输入设备
--disable-indevs disable input devices # 禁用所有输入设备
--enable-outdev=NAME enable output device NAME # 启用(NAME)输出设备
--disable-outdev=NAME disable output device NAME # 禁用(NAME)输出设备
--disable-outdevs disable output devices # 禁用所有输出设备
--disable-devices disable all devices # 禁用所有设备
--enable-filter=NAME enable filter NAME # 启用(NAME)filters
--disable-filter=NAME disable filter NAME # 禁用(NAME)filters
--disable-filters disable all filters # 禁用所有filters
# 外部库支持
External library support:
# 使用以下任何开关将允许FFmpeg链接到相应的外部库。如果满足所有其他依赖项且未显式禁用,则依赖于该库的所有组件都将启用。例如--enable libopus将启用到libopus的链接并允许构建libopus编码器, 除非使用--disable encoder=libopus专门禁用它。
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-libopus will enable linking to
libopus and allow the libopus encoder to be built, unless it is
specifically disabled with --disable-encoder=libopus.
# 请注意,只有系统库是自动检测的。所有其他外部库都必须显式启用。
Note that only the system libraries are auto-detected. All the other external
libraries must be explicitly enabled.
# 还请注意,以下帮助文本描述了库本身的用途,但FFmpeg不一定能使用它们的所有功能。
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] # 禁用ALSA支持[自动检测]
--disable-appkit disable Apple AppKit framework [autodetect] # 禁用Apple AppKit framework[自动检测]
--disable-avfoundation disable Apple AVFoundation framework [autodetect] # 禁用Apple AVFoundation framework[自动检测]
--enable-avisynth enable reading of AviSynth script files [no] # 启用读取AviSynth脚本文件[否]
--disable-bzlib disable bzlib [autodetect] # 禁用bzlib[自动检测]
--disable-coreimage disable Apple CoreImage framework [autodetect] # 用Apple CoreImage framework[自动检测]
--enable-chromaprint enable audio fingerprinting with chromaprint [no] # 使用chromaprint启用音频指纹[否]
--enable-frei0r enable frei0r video filtering [no] # 启用frei0r视频过滤
--enable-gcrypt enable gcrypt, needed for rtmp(t)e support
if openssl, librtmp or gmp is not used [no] # 如果未使用openssl、librtmp或gmp,则启用rtmp(t)e支持所需的gcrypt
--enable-gmp enable gmp, needed for rtmp(t)e support
if openssl or librtmp is not used [no] # 如果未使用openssl或librtmp,则启用rtmp(t)e支持所需的gmp
--enable-gnutls enable gnutls, needed for https support
if openssl, libtls or mbedtls is not used [no] # 如果未使用openssl、libtls或mbedtls,则启用https支持所需的gnutls
--disable-iconv disable iconv [autodetect] # 禁用iconv[自动检测]
--enable-jni enable JNI support [no] # 启用JNI支持[否]
--enable-ladspa enable LADSPA audio filtering [no] # 启用LADSPA音频过滤[否]
--enable-libaom enable AV1 video encoding/decoding via libaom [no] # 通过libaom启用AV1视频编码/解码[否]
--enable-libaribb24 enable ARIB text and caption decoding via libaribb24 [no] # 通过libaribb24启用ARIB文本和标题解码[否]
--enable-libass enable libass subtitles rendering,
needed for subtitles and ass filter [no] # 启用LIBAS字幕呈现,字幕和ass过滤器需要[no]
--enable-libbluray enable BluRay reading using libbluray [no] # 使用libbluray启用BluRay读取[否]
--enable-libbs2b enable bs2b DSP library [no] # 启用bs2b DSP库[否]
--enable-libcaca enable textual display using libcaca [no] # 使用libcaca启用文本显示[否]
--enable-libcelt enable CELT decoding via libcelt [no] # 通过libcelt启用CELT解码[否]
--enable-libcdio enable audio CD grabbing with libcdio [no] # 使用libcdio启用音频CD抓取[否]
--enable-libcodec2 enable codec2 en/decoding using libcodec2 [no] # 使用libcodec2启用codec2 en/解码[否]
--enable-libdav1d enable AV1 decoding via libdav1d [no] # 通过libdav1d启用AV1解码[否]
--enable-libdavs2 enable AVS2 decoding via libdavs2 [no] # 通过libdavs2启用AVS2解码[否]
--enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no] # 使用libdc1394和libraw1394启用IIDC-1394抓取[否]
--enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] # 通过libfdk AAC启用AAC反编码[否]
--enable-libflite enable flite (voice synthesis) support via libflite [no] # 通过libflite启用flite(语音合成)支持[no]
--enable-libfontconfig enable libfontconfig, useful for drawtext filter [no] # 启用libfontconfig,对drawtext筛选器有用[no]
--enable-libfreetype enable libfreetype, needed for drawtext filter [no] # 启用drawtext筛选器所需的libfreetype[否]
--enable-libfribidi enable libfribidi, improves drawtext filter [no] # 启用libfribidi,改进drawtext筛选器[否]
--enable-libglslang enable GLSL->SPIRV compilation via libglslang [no] # 通过libglslang启用GLSL->SPIRV编译[否]
--enable-libgme enable Game Music Emu via libgme [no] # 通过libgme启用游戏音乐Emu[否]
--enable-libgsm enable GSM de/encoding via libgsm [no] # 通过libgsm启用GSM去/编码[否]
--enable-libiec61883 enable iec61883 via libiec61883 [no] # 通过libiec61883启用iec61883[否]
--enable-libilbc enable iLBC de/encoding via libilbc [no] # 通过libilbc启用iLBC反编码[否]
--enable-libjack enable JACK audio sound server [no] # 启用插孔音频服务器[否]
--enable-libklvanc enable Kernel Labs VANC processing [no] # 启用内核实验室VANC处理[否]
--enable-libkvazaar enable HEVC encoding via libkvazaar [no] # 通过libkvazar启用HEVC编码[否]
--enable-liblensfun enable lensfun lens correction [no] # 启用镜头取消镜头校正[否]
--enable-libmodplug enable ModPlug via libmodplug [no] # 通过libmodplug启用ModPlug[否]
--enable-libmp3lame enable MP3 encoding via libmp3lame [no] # 通过libmp3lame启用MP3编码[否]
--enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] # 通过libopencore amrnb启用AMR-NB de/编码[否]
--enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] # 通过libopencore amrwb启用AMR-WB解码[否]
--enable-libopencv enable video filtering via libopencv [no] # 通过libopencv启用视频过滤[否]
--enable-libopenh264 enable H.264 encoding via OpenH264 [no] # 通过OpenH264启用H.264编码[否]
--enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no] # 通过OpenJPEG启用JPEG 2000反编码[否]
--enable-libopenmpt enable decoding tracked files via libopenmpt [no] # 通过libopenmpt启用对跟踪文件的解码[否]
--enable-libopenvino enable OpenVINO as a DNN module backend
for DNN based filters like dnn_processing [no] # 启用OpenVINO作为基于DNN的过滤器(如DNN_处理)的DNN模块后端[no]
--enable-libopus enable Opus de/encoding via libopus [no] # 通过libopus启用Opus de/encoding[否]
--enable-libpulse enable Pulseaudio input via libpulse [no] # 通过libpulse启用Pulseaudio输入[否]
--enable-librabbitmq enable RabbitMQ library [no] # 启用RabbitMQ库[否]
--enable-librav1e enable AV1 encoding via rav1e [no] # 通过rav1e启用AV1编码[否]
--enable-librist enable RIST via librist [no] # 通过librist启用RIST[否]
--enable-librsvg enable SVG rasterization via librsvg [no] # 通过librsvg启用SVG光栅化[否]
--enable-librubberband enable rubberband needed for rubberband filter [no] # 启用rubberband筛选器所需的rubberband[否]
--enable-librtmp enable RTMP[E] support via librtmp [no] # 通过librtmp[no]启用RTMP[E]支持
--enable-libshine enable fixed-point MP3 encoding via libshine [no] # 通过libshine启用定点MP3编码[否]
--enable-libsmbclient enable Samba protocol via libsmbclient [no] # 通过libsmbclient启用Samba协议[否]
--enable-libsnappy enable Snappy compression, needed for hap encoding [no] # 启用hap编码所需的Snappy压缩[否]
--enable-libsoxr enable Include libsoxr resampling [no] # 启用包含libsoxr重采样[否]
--enable-libspeex enable Speex de/encoding via libspeex [no] # 通过libspeex启用速度删除/编码[no]
--enable-libsrt enable Haivision SRT protocol via libsrt [no] # 通过libsrt启用Haivision SRT协议[否]
--enable-libssh enable SFTP protocol via libssh [no] # 通过libssh启用SFTP协议[否]
--enable-libsvtav1 enable AV1 encoding via SVT [no] # 通过SVT启用AV1编码[否]
--enable-libtensorflow enable TensorFlow as a DNN module backend
for DNN based filters like sr [no] # 启用TensorFlow作为基于DNN的筛选器(如sr[no])的DNN模块后端
--enable-libtesseract enable Tesseract, needed for ocr filter [no] # 启用ocr过滤器所需的Tesseract[否]
--enable-libtheora enable Theora encoding via libtheora [no] # 通过liborea启用Theora编码[否]
--enable-libtls enable LibreSSL (via libtls), needed for https support
if openssl, gnutls or mbedtls is not used [no] # 如果未使用openssl、gnutls或mbedtls,则启用https支持所需的LibreSSL(通过libtls)[否]
--enable-libtwolame enable MP2 encoding via libtwolame [no] # 通过libtwolame启用MP2编码[否]
--enable-libuavs3d enable AVS3 decoding via libuavs3d [no] # 通过libuavs3d启用AVS3解码[否]
--enable-libv4l2 enable libv4l2/v4l-utils [no] # 启用libv4l2/v4l-utils[否]
--enable-libvidstab enable video stabilization using vid.stab [no] # 使用vid.stab[否]启用视频稳定
--enable-libvmaf enable vmaf filter via libvmaf [no] # 通过libvmaf启用vmaf筛选器[否]
--enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] # 通过libvo amrwbenc启用AMR-WB编码[否]
--enable-libvorbis enable Vorbis en/decoding via libvorbis,
native implementation exists [no] # 通过libvorbis启用Vorbis en/解码,存在本机实现[否]
--enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no] 通过libvpx启用VP8和VP9数据编码/编码[否]
--enable-libwebp enable WebP encoding via libwebp [no] # 通过libwebp启用WebP编码[否]
--enable-libx264 enable H.264 encoding via x264 [no] # 通过x264启用H.264编码[否]
--enable-libx265 enable HEVC encoding via x265 [no] # 通过x265启用HEVC编码[否]
--enable-libxavs enable AVS encoding via xavs [no] # 通过xavs启用AVS编码[否]
--enable-libxavs2 enable AVS2 encoding via xavs2 [no] # 通过xavs2启用AVS2编码[否]
--enable-libxcb enable X11 grabbing using XCB [autodetect] # 使用XCB[自动检测]启用X11抓取
--enable-libxcb-shm enable X11 grabbing shm communication [autodetect] # 启用X11抓取shm通信[自动检测]
--enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect] # 启用X11抓取鼠标渲染[自动检测]
--enable-libxcb-shape enable X11 grabbing shape rendering [autodetect] # 启用X11抓取形状渲染[自动检测]
--enable-libxvid enable Xvid encoding via xvidcore,
native MPEG-4/Xvid encoder exists [no] #通过xvidcore启用Xvid编码,本机MPEG-4/Xvid编码器存在[否]
--enable-libxml2 enable XML parsing using the C library libxml2, needed
for dash demuxing support [no] # 使用C库libxml2启用XML解析,这是破折号分解支持所需的[no]
--enable-libzimg enable z.lib, needed for zscale filter [no] # 启用z.lib,zscale筛选器所需[no]
--enable-libzmq enable message passing via libzmq [no] # 启用通过libzmq传递消息[否]
--enable-libzvbi enable teletext support via libzvbi [no] # 通过libzvbi启用图文电视支持[否]
--enable-lv2 enable LV2 audio filtering [no] # 启用2级音频过滤[否]
--disable-lzma disable lzma [autodetect] # 禁用lzma[自动检测]
--enable-decklink enable Blackmagic DeckLink I/O support [no] # 启用Blackmagic DeckLink I/O支持[否]
--enable-mbedtls enable mbedTLS, needed for https support
if openssl, gnutls or libtls is not used [no] # 如果未使用openssl、gnutls或libtls,则启用https支持所需的mbedTLS[否]
--enable-mediacodec enable Android MediaCodec support [no] # 启用Android MediaCodec支持[否]
--enable-mediafoundation enable encoding via MediaFoundation [auto] # 通过MediaFoundation启用编码[自动]
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no] # 启用sofalizer筛选器所需的libmysofa[否]
--enable-openal enable OpenAL 1.1 capture support [no] # 启用OpenAL 1.1捕获支持[否]
--enable-opencl enable OpenCL processing [no] # 启用OpenCL处理[否]
--enable-opengl enable OpenGL rendering [no] # 启用OpenGL渲染[否]
--enable-openssl enable openssl, needed for https support
if gnutls, libtls or mbedtls is not used [no] # 如果未使用gnutls、libtls或mbedtls,则启用https支持所需的openssl[否]
--enable-pocketsphinx enable PocketSphinx, needed for asr filter [no] # 启用asr筛选器所需的PocketSphinx[否]
--disable-sndio disable sndio support [autodetect] # 禁用sndio支持[自动检测]
--disable-schannel disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used [autodetect] # 如果未使用openssl和gnutls,则禁用Windows上TLS支持所需的SChannel SSP[autodetect]
--disable-sdl2 disable sdl2 [autodetect] # 禁用sdl2[自动检测]
--disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used [autodetect] # 如果未使用openssl和gnutls,则禁用OSX上TLS支持所需的安全传输[autodetect]
--enable-vapoursynth enable VapourSynth demuxer [no] # 启用蒸汽同步解复用器[否]
--enable-vulkan enable Vulkan code [no] # 启用Vulkan代码[否]
--disable-xlib disable xlib [autodetect] # 禁用xlib[自动检测]
--disable-zlib disable zlib [autodetect] # 禁用zlib[自动检测]
# 以下库提供了各种硬件加速功能:
The following libraries provide various hardware acceleration features:
--disable-amf disable AMF video encoding code [autodetect] # 禁用AMF视频编码代码[自动检测]
--disable-audiotoolbox disable Apple AudioToolbox code [autodetect] # 禁用Apple AudioToolbox代码[自动检测]
--enable-cuda-nvcc enable Nvidia CUDA compiler [no] # 启用Nvidia CUDA编译器[否]
--disable-cuda-llvm disable CUDA compilation using clang [autodetect] # 使用clang[autodetect]禁用CUDA编译
--disable-cuvid disable Nvidia CUVID support [autodetect] # 禁用Nvidia CUVID支持[自动检测]
--disable-d3d11va disable Microsoft Direct3D 11 video acceleration code [autodetect] # 禁用Microsoft Direct3D 11视频加速代码[自动检测]
--disable-dxva2 disable Microsoft DirectX 9 video acceleration code [autodetect] # 禁用Microsoft DirectX 9视频加速代码[自动检测]
--disable-ffnvcodec disable dynamically linked Nvidia code [autodetect] # 禁用动态链接的Nvidia代码[自动检测]
--enable-libdrm enable DRM code (Linux) [no] # 启用DRM代码(Linux)[否]
--enable-libmfx enable Intel MediaSDK (AKA Quick Sync Video) code via libmfx [no] # 通过libmfx启用英特尔MediaSDK(又称快速同步视频)代码[否]
--enable-libnpp enable Nvidia Performance Primitives-based code [no] # 基于代码启用Nvidia性能原语[否]
--enable-mmal enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no] # 通过MMAL启用Broadcom多媒体抽象层(Raspberry Pi)
--disable-nvdec disable Nvidia video decoding acceleration (via hwaccel) [autodetect] # 禁用Nvidia视频解码加速(通过hwaccel)[自动检测]
--disable-nvenc disable Nvidia video encoding code [autodetect] # 禁用Nvidia视频编码代码[自动检测]
--enable-omx enable OpenMAX IL code [no] # 启用OpenMAX IL代码[否]
--enable-omx-rpi enable OpenMAX IL code for Raspberry Pi [no] # 为Raspberry Pi启用OpenMAX IL代码[否]
--enable-rkmpp enable Rockchip Media Process Platform code [no] # 启用Rockchip媒体处理平台代码[否]
--disable-v4l2-m2m disable V4L2 mem2mem code [autodetect] # 禁用V4L2 mem2mem代码[自动检测]
--disable-vaapi disable Video Acceleration API (mainly Unix/Intel) code [autodetect] # 禁用视频加速API(主要是Unix/Intel)代码[自动检测]
--disable-vdpau disable Nvidia Video Decode and Presentation API for Unix code [autodetect] # 禁用Unix代码的Nvidia视频解码和演示API[自动检测]
--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) # 选择所需的最小CPU(影响指令选择,可能会在旧CPU上崩溃)
--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 [] # 编译器目标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 # 强制固定目录/前缀而不是mktemp进行检查
--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) # 根据名称设置工具默认值(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] # 使用nm工具nm[nm-g]
--ar=AR use archive tool AR [ar] # 使用存档工具AR[AR]
--as=AS use assembler AS [] # 将汇编程序用作[]
--ln_s=LN_S use symbolic link tool LN_S [ln -s -f] # 使用符号链接工具LN_S[LN-S-f]
--strip=STRIP use strip tool STRIP [strip] # 使用剥离工具剥离[剥离]
--windres=WINDRES use windows resource compiler WINDRES [windres] # 使用windows资源编译器WINDRES[WINDRES]
--x86asmexe=EXE use nasm-compatible assembler EXE [nasm] # 使用nasm兼容的汇编程序EXE[nasm]
--cc=CC use C compiler CC [gcc] # 使用C编译器CC[gcc]
--cxx=CXX use C compiler CXX [g++] # 使用C编译器CXX[G++]
--objcc=OCC use ObjC compiler OCC [gcc] # 使用ObjC编译器OCC[gcc]
--dep-cc=DEPCC use dependency generator DEPCC [gcc] # 使用依赖项生成器DEPCC[gcc]
--nvcc=NVCC use Nvidia CUDA compiler NVCC or clang [] # 使用Nvidia CUDA编译器NVCC或clang[]
--ld=LD use linker LD [] # 使用链接器LD[]
--pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [pkg-config] # 使用pkg配置工具PKGCONFIG[pkg config]
--pkg-config-flags=FLAGS pass additional flags to pkgconf [] # 将其他标志传递给pkgconf[]
--ranlib=RANLIB use ranlib RANLIB [ranlib] # 使用ranlib ranlib[ranlib]
--doxygen=DOXYGEN use DOXYGEN to generate API doc [doxygen] # 使用DOXYGEN生成API文档[DOXYGEN]
--host-cc=HOSTCC use host C compiler HOSTCC # 使用主机C编译器HOSTCC
--host-cflags=HCFLAGS use HCFLAGS when compiling for host # 为主机编译时使用HCFLAGS
--host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host # 为主机编译时使用HCPPFLAGS
--host-ld=HOSTLD use host linker HOSTLD # 使用主机链接器HOSTLD
--host-ldflags=HLDFLAGS use HLDFLAGS when linking for host # 链接主机时使用HLDFLAGS
--host-extralibs=HLIBS use libs HLIBS when linking for host # 链接主机时使用libs HLIBS
--host-os=OS compiler host OS [] #编译器主机OS[]
--extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [] # 将ECFLAGS添加到CFLAGS[]
--extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [] # 将ECFLAGS添加到CXXFLAGS[]
--extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [] # 将标志添加到OBJCFLAGS[]
--extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [] # 将ELDFLAGS添加到LDFLAGS[]
--extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [] # 将ELDFLAGS添加到LDEXEFLAGS[]
--extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [] # 将ELDSOFLAGS添加到LDSOFLAGS[]
--extra-libs=ELIBS add ELIBS [] # 添加ELIBS[]
--extra-version=STRING version string suffix [] # 版本字符串后缀[]
--optflags=OPTFLAGS override optimization-related compiler flags # 重写与优化相关的编译器标志
--nvccflags=NVCCFLAGS override nvcc flags [] # 覆盖nvcc标志[]
--build-suffix=SUFFIX library name suffix [] # 库名称后缀[]
--enable-pic build position-independent code # 构建位置无关代码
--enable-thumb compile for Thumb instruction set # 为Thumb指令集编译
--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 # 在malloc和相关名称前面加前缀
--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] # swscale使用的最大过滤器大小为[256]
Optimization options (experts only):
--disable-asm disable all assembly optimizations # 禁用所有程序集优化
--disable-altivec disable AltiVec optimizations # 禁用AltiVec优化
--disable-vsx disable VSX optimizations # 禁用VSX优化
--disable-power8 disable POWER8 optimizations # 禁用POWER8优化
--disable-amd3dnow disable 3DNow! optimizations # 禁用3DNow!优化
--disable-amd3dnowext disable 3DNow! extended optimizations # 禁用3DNow!扩展优化
--disable-mmx disable MMX optimizations # 禁用MMX优化
--disable-mmxext disable MMXEXT optimizations # 禁用MMXEXT优化
--disable-sse disable SSE optimizations # 禁用SSE优化
--disable-sse2 disable SSE2 optimizations # 禁用SSE2优化
--disable-sse3 disable SSE3 optimizations # 禁用SSE3优化
--disable-ssse3 disable SSSE3 optimizations # 禁用SSE2优化
--disable-sse4 disable SSE4 optimizations # 禁用SSE4优化
--disable-sse42 disable SSE4.2 optimizations # 禁用SSE4.2优化
--disable-avx disable AVX optimizations # 禁用AVX优化
--disable-xop disable XOP optimizations # 禁用XOP优化
--disable-fma3 disable FMA3 optimizations # 禁用FMA3优化
--disable-fma4 disable FMA4 optimizations # 禁用FMA4优化
--disable-avx2 disable AVX2 optimizations # 禁用AVX2优化
--disable-avx512 disable AVX-512 optimizations # 禁用AVX-512优化
--disable-aesni disable AESNI optimizations # 禁用AESNI优化
--disable-armv5te disable armv5te optimizations # 禁用armv5te优化
--disable-armv6 disable armv6 optimizations # 禁用armv6优化
--disable-armv6t2 disable armv6t2 optimizations # 禁用armv6t2优化
--disable-vfp disable VFP optimizations # 禁用VFP优化
--disable-neon disable NEON optimizations # 禁用NEON优化,在android交叉编译可以开启
--disable-inline-asm disable use of inline assembly # 禁用内联程序集的使用
--disable-x86asm disable use of standalone x86 assembly # 禁用独立x86程序集的使用
--disable-mipsdsp disable MIPS DSP ASE R1 optimizations # 禁用MIPS DSP ASE R1优化
--disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations # 禁用MIPS DSP ASE R2优化
--disable-msa disable MSA optimizations # 禁用MSA优化
--disable-mipsfpu disable floating point MIPS optimizations # 禁用浮点MIPS优化
--disable-mmi disable Loongson SIMD optimizations # 禁用龙芯SIMD优化
--disable-fast-unaligned consider unaligned accesses slow # 考虑不对齐的访问慢
# 开发人员选项(在处理FFmpeg本身时很有用)
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. # 0(默认值)、1或2、断言测试量、2会导致运行时速度减慢。
--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 # 使用指定的valgrind二进制文件,通过valgrind运行“makefate”测试以检测内存泄漏和错误。不能与--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. # 命运测试样本的位置,如果未设置,则在make调用时使用$FATE_samples。
--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) # 检查XMM寄存器的关闭(仅限Win64;应仅用于调试目的)
--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). # 随机启用/禁用特定组件或组件组。列表是以逗号分隔的名称[:PROB]项列表,其中名称是一个组件(组),PROB是与名称关联的概率(默认值为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) # 不要在Valgrind下打印回溯(仅适用于--disable optimizations builds)
--enable-ossfuzz Enable building fuzzer tool # 启用构建模糊器工具
--libfuzzer=PATH path to libfuzzer # libfuzzer的路径
--ignore-tests=TESTS comma-separated list (without "fate-" prefix
in the name) of tests whose result is ignored # 结果被忽略的测试的逗号分隔列表(名称中不带“fate-”前缀)
--enable-linux-perf enable Linux Performance Monitor API # 启用Linux性能监视器API
--enable-macos-kperf enable macOS kperf (private) API # 启用macOS kperf(专用)API
--disable-large-tests disable tests that use a large amount of memory # 禁用使用大量内存的测试
--disable-ptx-compression don't compress CUDA PTX code even when possible # 即使可能,也不要压缩CUDA PTX代码
# 对象文件是在启动configure的位置生成的。
NOTE: Object files are built at the place where configure is launched.
截取视频
ffmpeg -ss 00:00:00 -t 00:00:30 -i dfxDemoCP1.mov -vcodec copy -acodec copy test.mov
- -ss 指定从什么时间开始
- -t 指定需要截取多长时间
- -i 指定输入文件
ffmpeg rtsp转rtmp推流
if __name__ == "__main__":
rtsp_server = 'rtmp://192.168.0.202:1935/stream/tang' # push server (output server)
# pull rtsp data, or your cv cap. (input server)
cap = cv2.VideoCapture(
'rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream')
sizeStr = str(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))) + \
'x' + str(int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
fps = int(cap.get(cv2.CAP_PROP_FPS))
command = ['ffmpeg',
'-y',
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24',
'-s', sizeStr,
'-r', str(fps),
'-i', '-',
'-pix_fmt', 'yuv420p',
'-f', 'flv',
rtsp_server]
p = sp.Popen(command, stdin=sp.PIPE)
while True:
ret, frame = cap.read()
if not ret:
print("Opening camera is failed")
break
p.stdin.write(frame.tostring())
ffmpeg rtsp保存到本地视频(python)
import ffmpeg
host = '172.28.51.122'
(
ffmpeg
# .input('rtsp://' + 'user:password@' + host)
.input('rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream')
.output('saved_rtsp.mp4')# 保存的文件名
.overwrite_output() # 覆盖同名文件
.run(capture_stdout=True)# 运行保存
)
rtsp播放
import cv2
cap = cv2.VideoCapture("rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream")
ret,frame = cap.read()
while ret:
ret,frame = cap.read()
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
cap.release()
推流
import cv2
import subprocess as sp
from multiprocessing import Process
import time
from threading import Thread
camera = {}
flag = False
def push(rtspUrl, rtmpUrl,cameraID):
rtmp_Url = rtmpUrl
rtsp_Url = cv2.VideoCapture(rtspUrl)
sizeStr = str(int(rtsp_Url.get(cv2.CAP_PROP_FRAME_WIDTH))) + \
'x' + str(int(rtsp_Url.get(cv2.CAP_PROP_FRAME_HEIGHT)))
fps = int(rtsp_Url.get(cv2.CAP_PROP_FPS))
command = ['ffmpeg',
'-y',
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24',
'-s', sizeStr,
'-r', str(fps),
'-i', '-',
'-pix_fmt', 'yuv420p',
'-f', 'flv',
rtmp_Url]
p = sp.Popen(command, stdin=sp.PIPE,shell=False)
while True:
ret, frame = rtsp_Url.read()
if not ret:
print("Opening camera is failed")
break
if camera[cameraID]["stutus"]:
p.stdin.write(frame.tostring())
else:
break
# 摄像头使用情况,id 摄像头id, use 摄像头使用人数
def push_stream(cameras, rtspUrl, rtmpUrl):
# 遍历传过来的多个摄像头
for cameraID in cameras:
# 是否在set集合里
print(cameraID)
if cameraID in camera.keys():
camera[cameraID]["usage"] += 1
continue
else:
print('start')
# pr = Process(target=push, args=(rtspUrl, rtmpUrl), name=cameraID) # 创建进程
pr = Thread(target=push, args=(rtspUrl, rtmpUrl, cameraID), name=cameraID) #创建线程
# pr = spawn(target=push, args=(rtspUrl, rtmpUrl, cameraID), name=cameraID) # 创建协程
pr.start()
camera[cameraID] = {"thread": pr, "usage": 1,"stutus":True}
def stop_stream(cameras):
for cameraID in cameras:
print("***")
if cameraID in camera.keys():
# 在集合里,使用人数为1,停止推流
if camera[cameraID]["usage"] == 1:
camera[cameraID]["stutus"] = False
# camera[cameraID]["thread"].terminate()
camera[cameraID]["thread"].join()
# camera[cameraID]["thread"].kill()
camera[cameraID]["thread"] = None
print('stop spawn')
del (camera[cameraID])
else:
camera[cameraID]["usage"] -= 1
if __name__ == "__main__":
push_stream({"c1",}, "rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream",
"rtmp://192.168.0.202:1935/stream/tang1")
push_stream({"c2", }, "rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream",
"rtmp://192.168.0.202:1935/stream/tang2")
push_stream({"c3", }, "rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream",
"rtmp://192.168.0.202:1935/stream/tang3")
for k, v in camera.items():
print(k, '=', v)
time.sleep(10)
stop_stream({"c1","c2"})
for k, v in camera.items():
print(k, '=', v)
import cv2
import subprocess as sp
if __name__ == "__main__":
rtsp_server = 'rtmp://192.168.0.202:1935/stream/tang' # push server (output server)
# pull rtsp data, or your cv cap. (input server)
cap = cv2.VideoCapture(
'rtsp://admin:12345qwert@192.168.0.5:554/h264/ch1/main/av_stream')
sizeStr = str(int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))) + \
'x' + str(int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
fps = int(cap.get(cv2.CAP_PROP_FPS))
command = ['ffmpeg',
'-y',
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-pix_fmt', 'bgr24',
'-s', sizeStr,
'-r', str(fps),
'-i', '-',
'-pix_fmt', 'yuv420p',
'-f', 'flv',
rtsp_server]
p = sp.Popen(command, stdin=sp.PIPE)
while True:
ret, frame = cap.read()
if not ret:
print("Opening camera is failed")
break
p.stdin.write(frame.tostring())