What other build options exist to compile the most superior configuration of FFmpeg?

0

According to the FFmpeg documentation, the best AAC encoder that FFmpeg can make use of is Fraunhofer Society's Fraunhofer FDK AAC encoder, and there doesn't seem to be any disagreement about this.

However, to comply with the GPL FFmpeg doesn't include the encoder in its binaries by default, and the only way to install it is to compile FFmpeg from source with the --enable-libfdk-aac build option.

This made me wonder what other such options FFmpeg can be compiled with in order to give me the best build for creating the most efficient (i.e. the highest quality at the lowest bitrate) audio.

For example, what advantages does compiling with --enable-nonfree (or not compiling with --enable-gpl) offer? It seems odd to me that all these options to improve the software exist but there exists no central place where they're documented and explained.

Hashim

Posted 2019-03-04T00:16:00.073

Reputation: 6 967

Answers

2

First of all, to see a complete list of configure options refer to ./configure --help.

According to the FFmpeg documentation...

This isn't actually the documentation but is a wiki that is editable by anyone, so like any wiki you may want to independently verify any claims.

This made me wonder what other such options FFmpeg can be compiled with in order to give me the best build for creating the most efficient (i.e. the highest quality at the lowest bitrate) audio.

This is currently Opus audio. Enable it with --enable-libopus, and use the latest version of libopus if you want to take advantage of recent development activity.

There are claims that the Sox audio resampler is better than the built-in resampler in FFmpeg. I haven't tried it much myself. Enable it with --enable-libsoxr.

What advantages does compiling with --enable-nonfree offer?

This option alone gives no advantages. It is required for some external libraries that are considered to be non-free. You can view which libraries require this in the source code of the configure file: refer to EXTERNAL_LIBRARY_NONFREE_LIST (and HWACCEL_LIBRARY_NONFREE_LIST). As of this answer these include: decklink, libndi_newtek, libfdk_aac, openssl, libtls (and cuda_nvcc, cuda_sdk, libnpp).

A disadvantage of using --enable-nonfree is that the resulting build will be non-free and therefore non-redistributable.

What advantages does not compiling with --enable-gpl offer?

Slightly faster to compile. Somewhat smaller resulting executable file size. LGPL 2.1 license instead of GPL 2. However, these may not be of any concern to you.

See LICENSE.md included in the source code for a complete list of what requires --enable-gpl.

llogan

Posted 2019-03-04T00:16:00.073

Reputation: 31 929

This is a good answer, but it doesn't seem to make any mention of the disadvantages of --enable-gpl and all the encoders it disables. Also, I would consider the enabling of external libraries that are otherwise disabled to be clear advantages for --enable-nonfree. – Hashim – 2019-03-05T19:43:47.747

@Hashim You only asked about advantages of not including --enable-gpl, but semantics aside, including --enable-gpl does not disable any encoders. --enable-nonfree does not enable anything: it does nothing but change the license to nonfree and unredistributable and is required for non-free external libraries. – llogan – 2019-03-05T20:05:42.313

@Hashim Regarding missing out of stuff by not including --enable-gpl: I covered that in the very last sentence. LICENSE.md explains it all: it was too much to copy and paste in the answer. – llogan – 2019-03-05T20:10:15.343

Are you saying that the --enable-gpl and --enable-nonfree build options do nothing for bundling the libraries that FFmpeg is compiled with, but are there only to change the type of the license that it's compiled with (i.e. a legal requirement)? If so, this is confusing, because the FFmpeg license itself states "If you wish to enable these libraries, pass --enable-nonfree to configure", and "None of these parts are used by default, you have to explicitly pass --enable-gpl to configure to activate them." – Hashim – 2019-03-05T20:12:16.697

@Hashim No. --enable-gpl enables many things including some built-in FFmpeg components and is required for some external libraries. --enable-nonfree does not enable anything (there are no non-free built-in FFmpeg components), but is required for some external libraries. You should really read LICENSE.md if you haven't. The words you quote could be more clear: "If you wish to use any non-free libraries then --enable-nonfree is required". – llogan – 2019-03-05T20:21:10.183

I think I see now. I've read through the license several times, both before and after posting the question, and could never quite grasp what it was saying. For example, you say --enable-nonfree does not enable anything, yet the license that you keep referring me to states "If you wish to enable these libraries, pass --enable-nonfree to configure". The whole thing could be made far clearer, just like all of the build options that FFmpeg can be configured with could have been documented somewhere. – Hashim – 2019-03-05T20:22:15.537

1@Hashim Yes, it should be re-worded. The configure options are "documented" in ./configure --help, or at least that's what a developer will tell you. Development activity is high, so any manually generated list of configure options would be a maintenance burden and become obsolete fairly quickly. – llogan – 2019-03-05T20:27:04.947

This is the first I'm hearing of ./configure --help, or at least that doing so would give me a comprehensive list of options. Thank you. – Hashim – 2019-03-05T20:28:21.767

1@Hashim I should have mentioned that first thing in the answer. – llogan – 2019-03-05T20:32:10.703

1

Thanks to llogan for pointing out that the full list of configuration options can be found by doing ./configure --help in the directory containing the FFmpeg sources. Unfortunately this information isn't documented anywhere else, so to make it available without requiring that FFmpeg's sources are downloaded, I've reproduced them below.

Note that I've only reproduced the configuration options that enable/disable support for a particular external library or hardware acceleration feature - general program configuration or debugging options have been omitted. Each option is followed by a description in square brackets of whether the option is enabled by default in FFmpeg or whether support for it is autodetected:

Licensing options:

  --enable-gpl             allow use of GPL code, the resulting libs and binaries will be under GPL [no]
  --enable-version3        upgrade (L)GPL to version 3 [no]
  --enable-nonfree         allow use of nonfree code, the resulting libs and binaries will be unredistributable [no]

External library support:

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

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

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

  --disable-alsa           disable ALSA support [autodetect]
  --disable-appkit         disable Apple AppKit framework [autodetect]
  --disable-avfoundation   disable Apple AVFoundation framework [autodetect]
  --enable-avisynth        enable reading of AviSynth script files [no]
  --disable-bzlib          disable bzlib [autodetect]
  --disable-coreimage      disable Apple CoreImage framework [autodetect]
  --enable-chromaprint     enable audio fingerprinting with chromaprint [no]
  --enable-frei0r          enable frei0r video filtering [no]
  --enable-gcrypt          enable gcrypt, needed for rtmp(t)e support if openssl, librtmp or gmp is not used [no]
  --enable-gmp             enable gmp, needed for rtmp(t)e support if openssl or librtmp is not used [no]
  --enable-gnutls          enable gnutls, needed for https support if openssl, libtls or mbedtls is not used [no]
  --disable-iconv          disable iconv [autodetect]    
  --enable-jni             enable JNI support [no]
  --enable-ladspa          enable LADSPA audio filtering [no]
  --enable-libaom          enable AV1 video encoding/decoding via libaom [no]
  --enable-libaribb24      enable ARIB text and caption decoding via libaribb24 [no]
  --enable-libass          enable libass subtitles rendering, needed for subtitles and ass filter [no]
  --enable-libbluray       enable BluRay reading using libbluray [no]
  --enable-libbs2b         enable bs2b DSP library [no]
  --enable-libcaca         enable textual display using libcaca [no]
  --enable-libcelt         enable CELT decoding via libcelt [no]
  --enable-libcdio         enable audio CD grabbing with libcdio [no]
  --enable-libcodec2       enable codec2 en/decoding using libcodec2 [no]
  --enable-libdav1d        enable AV1 decoding via libdav1d [no]
  --enable-libdavs2        enable AVS2 decoding via libdavs2 [no]
  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no]
  --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
  --enable-libflite        enable flite (voice synthesis) support via libflite [no]
  --enable-libfontconfig   enable libfontconfig, useful for drawtext filter [no]
  --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
  --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
  --enable-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-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]
  --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]
  --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-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]

Also note that some codecs above, such as Xvid and Vorbis, already have encoders native to FFmpeg and don't require that any additional encoders be enabled.

Additional information on licensing options can be found from this screenshot of the Media Auto Build Suite, which I found to contain the best explanation I've come across so far of what the licensing options mean and what their implications are:

enter image description here

Hashim

Posted 2019-03-04T00:16:00.073

Reputation: 6 967