2021-04-10 10:30:54 +02:00
|
|
|
{ lib, stdenv, ffmpeg, addOpenGLRunpath, pkg-config, perl, texinfo, yasm
|
2015-04-07 09:34:27 +02:00
|
|
|
/*
|
|
|
|
* Licensing options (yes some are listed twice, filters and such are not listed)
|
|
|
|
*/
|
|
|
|
, gplLicensing ? true # GPL: fdkaac,openssl,frei0r,cdio,samba,utvideo,vidstab,x265,x265,xavs,avid,zvbi,x11grab
|
2019-10-08 23:58:44 +02:00
|
|
|
, version3Licensing ? true # (L)GPL3: libvmaf,opencore-amrnb,opencore-amrwb,samba,vo-aacenc,vo-amrwbenc
|
2017-01-25 03:35:42 +01:00
|
|
|
, nonfreeLicensing ? false # NONFREE: openssl,fdkaac,blackmagic-design-desktop-video
|
2015-04-07 09:34:27 +02:00
|
|
|
/*
|
|
|
|
* Build options
|
|
|
|
*/
|
|
|
|
, smallBuild ? false # Optimize for size instead of speed
|
|
|
|
, runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime (disable to compile natively)
|
|
|
|
, grayBuild ? true # Full grayscale support
|
|
|
|
, swscaleAlphaBuild ? true # Alpha channel support in swscale
|
|
|
|
, hardcodedTablesBuild ? true # Hardcode decode tables instead of runtime generation
|
|
|
|
, safeBitstreamReaderBuild ? true # Buffer boundary checking in bitreaders
|
|
|
|
, multithreadBuild ? true # Multithreading via pthreads/win32 threads
|
|
|
|
, networkBuild ? true # Network support
|
|
|
|
, pixelutilsBuild ? true # Pixel utils in libavutil
|
2017-05-07 08:34:03 +02:00
|
|
|
, enableLto ? false # build with link-time optimization
|
2015-04-07 09:34:27 +02:00
|
|
|
/*
|
|
|
|
* Program options
|
|
|
|
*/
|
|
|
|
, ffmpegProgram ? true # Build ffmpeg executable
|
|
|
|
, ffplayProgram ? true # Build ffplay executable
|
|
|
|
, ffprobeProgram ? true # Build ffprobe executable
|
|
|
|
, qtFaststartProgram ? true # Build qt-faststart executable
|
|
|
|
/*
|
|
|
|
* Library options
|
|
|
|
*/
|
|
|
|
, avcodecLibrary ? true # Build avcodec library
|
|
|
|
, avdeviceLibrary ? true # Build avdevice library
|
|
|
|
, avfilterLibrary ? true # Build avfilter library
|
|
|
|
, avformatLibrary ? true # Build avformat library
|
|
|
|
, avresampleLibrary ? true # Build avresample library
|
|
|
|
, avutilLibrary ? true # Build avutil library
|
|
|
|
, postprocLibrary ? true # Build postproc library
|
|
|
|
, swresampleLibrary ? true # Build swresample library
|
|
|
|
, swscaleLibrary ? true # Build swscale library
|
|
|
|
/*
|
|
|
|
* Documentation options
|
|
|
|
*/
|
|
|
|
, htmlpagesDocumentation ? false # HTML documentation pages
|
|
|
|
, manpagesDocumentation ? true # Man documentation pages
|
|
|
|
, podpagesDocumentation ? false # POD documentation pages
|
|
|
|
, txtpagesDocumentation ? false # Text documentation pages
|
|
|
|
/*
|
|
|
|
* External libraries options
|
|
|
|
*/
|
|
|
|
, alsaLib ? null # Alsa in/output support
|
|
|
|
#, avisynth ? null # Support for reading AviSynth scripts
|
|
|
|
, bzip2 ? null
|
|
|
|
, celt ? null # CELT decoder
|
|
|
|
#, crystalhd ? null # Broadcom CrystalHD hardware acceleration
|
2019-08-21 16:15:47 +02:00
|
|
|
, dav1d ? null # AV1 decoder (focused on speed and correctness)
|
2015-04-07 09:34:27 +02:00
|
|
|
#, decklinkExtlib ? false, blackmagic-design-desktop-video ? null # Blackmagic Design DeckLink I/O support
|
|
|
|
, fdkaacExtlib ? false, fdk_aac ? null # Fraunhofer FDK AAC de/encoder
|
|
|
|
#, flite ? null # Flite (voice synthesis) support
|
|
|
|
, fontconfig ? null # Needed for drawtext filter
|
|
|
|
, freetype ? null # Needed for drawtext filter
|
|
|
|
, frei0r ? null # frei0r video filtering
|
|
|
|
, fribidi ? null # Needed for drawtext filter
|
|
|
|
, game-music-emu ? null # Game Music Emulator
|
|
|
|
, gnutls ? null
|
|
|
|
, gsm ? null # GSM de/encoder
|
|
|
|
#, ilbc ? null # iLBC de/encoder
|
2015-06-27 09:17:52 +02:00
|
|
|
, libjack2 ? null # Jack audio (only version 2 is supported in this build)
|
2015-04-07 09:34:27 +02:00
|
|
|
, ladspaH ? null # LADSPA audio filtering
|
|
|
|
, lame ? null # LAME MP3 encoder
|
|
|
|
, libass ? null # (Advanced) SubStation Alpha subtitle rendering
|
2018-08-01 17:03:44 +02:00
|
|
|
, libaom ? null # AV1 encoder
|
2015-04-07 09:34:27 +02:00
|
|
|
, libbluray ? null # BluRay reading
|
|
|
|
, libbs2b ? null # bs2b DSP library
|
|
|
|
, libcaca ? null # Textual display (ASCII art)
|
|
|
|
#, libcdio-paranoia ? null # Audio CD grabbing
|
|
|
|
, libdc1394 ? null, libraw1394 ? null # IIDC-1394 grabbing (ieee 1394)
|
|
|
|
, libiconv ? null
|
|
|
|
#, libiec61883 ? null, libavc1394 ? null # iec61883 (also uses libraw1394)
|
2019-03-11 08:10:56 +01:00
|
|
|
, libmfx ? null # Hardware acceleration vis libmfx
|
2015-04-07 09:34:27 +02:00
|
|
|
, libmodplug ? null # ModPlug support
|
2018-03-26 12:35:23 +02:00
|
|
|
, libmysofa ? null # HRTF support via SOFAlizer
|
2015-04-07 09:34:27 +02:00
|
|
|
#, libnut ? null # NUT (de)muxer, native (de)muser exists
|
|
|
|
, libogg ? null # Ogg container used by vorbis & theora
|
|
|
|
, libopus ? null # Opus de/encoder
|
2020-06-12 06:58:35 +02:00
|
|
|
, librsvg ? null # SVG protocol
|
2015-04-07 09:34:27 +02:00
|
|
|
, libssh ? null # SFTP protocol
|
|
|
|
, libtheora ? null # Theora encoder
|
|
|
|
, libv4l ? null # Video 4 Linux support
|
|
|
|
, libva ? null # Vaapi hardware acceleration
|
|
|
|
, libvdpau ? null # Vdpau hardware acceleration
|
2019-10-08 23:58:44 +02:00
|
|
|
, libvmaf ? null # Netflix's VMAF (Video Multi-Method Assessment Fusion)
|
2015-04-07 09:34:27 +02:00
|
|
|
, libvorbis ? null # Vorbis de/encoding, native encoder exists
|
|
|
|
, libvpx ? null # VP8 & VP9 de/encoding
|
|
|
|
, libwebp ? null # WebP encoder
|
|
|
|
, libX11 ? null # Xlib support
|
|
|
|
, libxcb ? null # X11 grabbing using XCB
|
|
|
|
, libxcbshmExtlib ? true # X11 grabbing shm communication
|
|
|
|
, libxcbxfixesExtlib ? true # X11 grabbing mouse rendering
|
|
|
|
, libxcbshapeExtlib ? true # X11 grabbing shape rendering
|
|
|
|
, libXv ? null # Xlib support
|
2018-12-17 16:48:54 +01:00
|
|
|
, libXext ? null # Xlib support
|
2021-03-14 19:12:53 +01:00
|
|
|
, xz ? null # xz-utils
|
2019-08-23 11:01:47 +02:00
|
|
|
, nvenc ? !stdenv.isDarwin && !stdenv.isAarch64, nv-codec-headers ? null # NVIDIA NVENC support
|
2015-04-07 09:34:27 +02:00
|
|
|
, openal ? null # OpenAL 1.1 capture support
|
|
|
|
#, opencl ? null # OpenCL code
|
2017-08-09 03:40:36 +02:00
|
|
|
, opencore-amr ? null # AMR-NB de/encoder & AMR-WB decoder
|
2015-04-07 09:34:27 +02:00
|
|
|
#, opencv ? null # Video filtering
|
2019-11-10 17:44:34 +01:00
|
|
|
, openglExtlib ? false, libGL ? null, libGLU ? null # OpenGL rendering
|
2015-04-07 09:34:27 +02:00
|
|
|
#, openh264 ? null # H.264/AVC encoder
|
2018-05-12 11:45:22 +02:00
|
|
|
, openjpeg ? null # JPEG 2000 de/encoder
|
2015-04-07 09:34:27 +02:00
|
|
|
, opensslExtlib ? false, openssl ? null
|
2015-05-27 21:42:15 +02:00
|
|
|
, libpulseaudio ? null # Pulseaudio input support
|
2020-09-09 15:52:34 +02:00
|
|
|
, rav1e ? null # AV1 encoder (focused on speed and safety)
|
2020-12-04 15:07:56 +01:00
|
|
|
, svt-av1 ? null # AV1 encoder/decoder (focused on speed and correctness)
|
2015-04-07 09:34:27 +02:00
|
|
|
, rtmpdump ? null # RTMP[E] support
|
|
|
|
#, libquvi ? null # Quvi input support
|
|
|
|
, samba ? null # Samba protocol
|
|
|
|
#, schroedinger ? null # Dirac de/encoder
|
2017-04-07 05:12:20 +02:00
|
|
|
, SDL2 ? null
|
2015-04-07 09:34:27 +02:00
|
|
|
#, shine ? null # Fixed-point MP3 encoder
|
|
|
|
, soxr ? null # Resampling via soxr
|
|
|
|
, speex ? null # Speex de/encoder
|
2020-06-28 01:28:02 +02:00
|
|
|
, srt ? null # Secure Reliable Transport (SRT) protocol
|
2015-04-07 09:34:27 +02:00
|
|
|
#, twolame ? null # MP2 encoder
|
|
|
|
#, utvideo ? null # Ut Video de/encoder
|
|
|
|
, vid-stab ? null # Video stabilization
|
|
|
|
#, vo-aacenc ? null # AAC encoder
|
2018-04-17 17:41:47 +02:00
|
|
|
, vo-amrwbenc ? null # AMR-WB encoder
|
2015-04-07 09:34:27 +02:00
|
|
|
, x264 ? null # H.264/AVC encoder
|
|
|
|
, x265 ? null # H.265/HEVC encoder
|
|
|
|
, xavs ? null # AVS encoder
|
|
|
|
, xvidcore ? null # Xvid encoder, native encoder exists
|
|
|
|
, zeromq4 ? null # Message passing
|
|
|
|
, zlib ? null
|
2021-04-24 16:36:06 +02:00
|
|
|
, vulkan-loader ? null
|
|
|
|
, glslang ? null
|
2015-04-07 09:34:27 +02:00
|
|
|
#, zvbi ? null # Teletext support
|
|
|
|
/*
|
|
|
|
* Developer options
|
|
|
|
*/
|
|
|
|
, debugDeveloper ? false
|
|
|
|
, optimizationsDeveloper ? true
|
|
|
|
, extraWarningsDeveloper ? false
|
|
|
|
, strippingDeveloper ? false
|
2015-11-11 22:56:38 +01:00
|
|
|
/*
|
|
|
|
* Darwin frameworks
|
|
|
|
*/
|
2016-08-31 20:03:58 +02:00
|
|
|
, Cocoa, CoreAudio, CoreServices, AVFoundation, MediaToolbox
|
2019-06-19 20:01:18 +02:00
|
|
|
, VideoDecodeAcceleration
|
2015-04-07 09:34:27 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
/* Maintainer notes:
|
|
|
|
*
|
|
|
|
* Version bumps:
|
|
|
|
* It should always be safe to bump patch releases (e.g. 2.1.x, x being a patch release)
|
|
|
|
* If adding a new branch, note any configure flags that were added, changed, or deprecated/removed
|
|
|
|
* and make the necessary changes.
|
|
|
|
*
|
|
|
|
* Packages with errors:
|
|
|
|
* flite ilbc schroedinger
|
|
|
|
* opencv - circular dependency issue
|
|
|
|
*
|
|
|
|
* Not packaged:
|
|
|
|
* aacplus avisynth cdio-paranoia crystalhd libavc1394 libiec61883
|
2019-03-11 08:10:56 +01:00
|
|
|
* libnut libquvi nvenc opencl openh264 oss shine twolame
|
2015-04-07 09:34:27 +02:00
|
|
|
* utvideo vo-aacenc vo-amrwbenc xvmc zvbi blackmagic-design-desktop-video
|
|
|
|
*
|
|
|
|
* Need fixes to support Darwin:
|
2020-12-05 17:33:00 +01:00
|
|
|
* gsm libjack2 libmodplug libmfx(intel-media-sdk) nvenc pulseaudio samba
|
|
|
|
* vid-stab
|
2015-04-07 09:34:27 +02:00
|
|
|
*
|
2019-08-23 11:01:47 +02:00
|
|
|
* Need fixes to support AArch64:
|
|
|
|
* libmfx(intel-media-sdk) nvenc
|
|
|
|
*
|
2015-04-07 09:34:27 +02:00
|
|
|
* Not supported:
|
|
|
|
* stagefright-h264(android only)
|
|
|
|
*
|
|
|
|
* Known issues:
|
|
|
|
* flite: configure fails to find library
|
|
|
|
* Tried modifying ffmpeg's configure script and flite to use pkg-config
|
|
|
|
* Cross-compiling will disable features not present on host OS
|
|
|
|
* (e.g. dxva2 support [DirectX] will not be enabled unless natively compiled on Cygwin)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
let
|
2019-08-23 11:01:47 +02:00
|
|
|
inherit (stdenv) isCygwin isDarwin isFreeBSD isLinux isAarch64;
|
2021-01-21 18:00:13 +01:00
|
|
|
inherit (lib) optional optionals optionalString enableFeature;
|
2015-04-07 09:34:27 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Licensing dependencies
|
|
|
|
*/
|
|
|
|
assert version3Licensing -> gplLicensing;
|
|
|
|
assert nonfreeLicensing -> gplLicensing && version3Licensing;
|
|
|
|
/*
|
|
|
|
* Build dependencies
|
|
|
|
*/
|
|
|
|
assert networkBuild -> gnutls != null || opensslExtlib;
|
|
|
|
assert pixelutilsBuild -> avutilLibrary;
|
2019-06-22 05:04:23 +02:00
|
|
|
/*
|
|
|
|
* Platform dependencies
|
|
|
|
*/
|
|
|
|
assert isDarwin -> !nvenc;
|
2015-04-07 09:34:27 +02:00
|
|
|
/*
|
|
|
|
* Program dependencies
|
|
|
|
*/
|
|
|
|
assert ffmpegProgram -> avcodecLibrary
|
|
|
|
&& avfilterLibrary
|
|
|
|
&& avformatLibrary
|
|
|
|
&& swresampleLibrary;
|
|
|
|
assert ffplayProgram -> avcodecLibrary
|
|
|
|
&& avformatLibrary
|
|
|
|
&& swscaleLibrary
|
|
|
|
&& swresampleLibrary
|
2017-04-07 05:12:20 +02:00
|
|
|
&& SDL2 != null;
|
2015-04-07 09:34:27 +02:00
|
|
|
assert ffprobeProgram -> avcodecLibrary && avformatLibrary;
|
|
|
|
/*
|
|
|
|
* Library dependencies
|
|
|
|
*/
|
|
|
|
assert avcodecLibrary -> avutilLibrary; # configure flag since 0.6
|
|
|
|
assert avdeviceLibrary -> avformatLibrary
|
|
|
|
&& avcodecLibrary
|
|
|
|
&& avutilLibrary; # configure flag since 0.6
|
|
|
|
assert avformatLibrary -> avcodecLibrary && avutilLibrary; # configure flag since 0.6
|
|
|
|
assert avresampleLibrary -> avutilLibrary;
|
|
|
|
assert postprocLibrary -> avutilLibrary;
|
|
|
|
assert swresampleLibrary -> soxr != null;
|
|
|
|
assert swscaleLibrary -> avutilLibrary;
|
|
|
|
/*
|
|
|
|
* External libraries
|
|
|
|
*/
|
|
|
|
#assert decklinkExtlib -> blackmagic-design-desktop-video != null
|
|
|
|
# && !isCygwin && multithreadBuild # POSIX threads required
|
|
|
|
# && nonfreeLicensing;
|
|
|
|
assert fdkaacExtlib -> fdk_aac != null && nonfreeLicensing;
|
|
|
|
assert gnutls != null -> !opensslExtlib;
|
|
|
|
assert libxcbshmExtlib -> libxcb != null;
|
|
|
|
assert libxcbxfixesExtlib -> libxcb != null;
|
|
|
|
assert libxcbshapeExtlib -> libxcb != null;
|
2019-11-10 17:44:34 +01:00
|
|
|
assert openglExtlib -> libGL != null && libGLU != null;
|
2015-04-07 09:34:27 +02:00
|
|
|
assert opensslExtlib -> gnutls == null && openssl != null && nonfreeLicensing;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "ffmpeg-full";
|
2020-06-08 06:38:32 +02:00
|
|
|
inherit (ffmpeg) src version;
|
2019-08-21 16:15:47 +02:00
|
|
|
|
2017-11-28 00:24:02 +01:00
|
|
|
prePatch = ''
|
|
|
|
patchShebangs .
|
2021-01-21 18:00:13 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2016-08-31 20:03:58 +02:00
|
|
|
sed -i 's/#ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
|
2021-01-21 18:00:13 +01:00
|
|
|
'' + lib.optionalString (frei0r != null) ''
|
2017-07-30 12:52:03 +02:00
|
|
|
substituteInPlace libavfilter/vf_frei0r.c \
|
|
|
|
--replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
|
|
|
|
substituteInPlace doc/filters.texi \
|
|
|
|
--replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1
|
2016-08-31 20:03:58 +02:00
|
|
|
'';
|
2015-04-07 09:34:27 +02:00
|
|
|
|
2018-05-10 07:38:51 +02:00
|
|
|
configurePlatforms = [];
|
2015-04-07 09:34:27 +02:00
|
|
|
configureFlags = [
|
2018-08-20 20:43:41 +02:00
|
|
|
"--target_os=${stdenv.hostPlatform.parsed.kernel.name}"
|
|
|
|
"--arch=${stdenv.hostPlatform.parsed.cpu.name}"
|
2015-04-07 09:34:27 +02:00
|
|
|
/*
|
|
|
|
* Licensing flags
|
|
|
|
*/
|
|
|
|
(enableFeature gplLicensing "gpl")
|
|
|
|
(enableFeature version3Licensing "version3")
|
|
|
|
(enableFeature nonfreeLicensing "nonfree")
|
|
|
|
/*
|
|
|
|
* Build flags
|
|
|
|
*/
|
|
|
|
# On some ARM platforms --enable-thumb
|
2019-08-31 14:10:53 +02:00
|
|
|
"--enable-shared"
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature true "pic")
|
|
|
|
(enableFeature smallBuild "small")
|
|
|
|
(enableFeature runtimeCpuDetectBuild "runtime-cpudetect")
|
2017-05-07 08:34:03 +02:00
|
|
|
(enableFeature enableLto "lto")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature grayBuild "gray")
|
|
|
|
(enableFeature swscaleAlphaBuild "swscale-alpha")
|
|
|
|
(enableFeature hardcodedTablesBuild "hardcoded-tables")
|
|
|
|
(enableFeature safeBitstreamReaderBuild "safe-bitstream-reader")
|
|
|
|
(if multithreadBuild then (
|
|
|
|
if isCygwin then
|
|
|
|
"--disable-pthreads --enable-w32threads"
|
|
|
|
else # Use POSIX threads by default
|
|
|
|
"--enable-pthreads --disable-w32threads")
|
|
|
|
else
|
|
|
|
"--disable-pthreads --disable-w32threads")
|
|
|
|
"--disable-os2threads" # We don't support OS/2
|
|
|
|
(enableFeature networkBuild "network")
|
|
|
|
(enableFeature pixelutilsBuild "pixelutils")
|
|
|
|
/*
|
|
|
|
* Program flags
|
|
|
|
*/
|
|
|
|
(enableFeature ffmpegProgram "ffmpeg")
|
|
|
|
(enableFeature ffplayProgram "ffplay")
|
|
|
|
(enableFeature ffprobeProgram "ffprobe")
|
|
|
|
/*
|
|
|
|
* Library flags
|
|
|
|
*/
|
|
|
|
(enableFeature avcodecLibrary "avcodec")
|
|
|
|
(enableFeature avdeviceLibrary "avdevice")
|
|
|
|
(enableFeature avfilterLibrary "avfilter")
|
|
|
|
(enableFeature avformatLibrary "avformat")
|
|
|
|
(enableFeature avresampleLibrary "avresample")
|
|
|
|
(enableFeature avutilLibrary "avutil")
|
|
|
|
(enableFeature (postprocLibrary && gplLicensing) "postproc")
|
|
|
|
(enableFeature swresampleLibrary "swresample")
|
|
|
|
(enableFeature swscaleLibrary "swscale")
|
|
|
|
/*
|
|
|
|
* Documentation flags
|
|
|
|
*/
|
|
|
|
(enableFeature (htmlpagesDocumentation
|
|
|
|
|| manpagesDocumentation
|
|
|
|
|| podpagesDocumentation
|
|
|
|
|| txtpagesDocumentation) "doc")
|
|
|
|
(enableFeature htmlpagesDocumentation "htmlpages")
|
|
|
|
(enableFeature manpagesDocumentation "manpages")
|
|
|
|
(enableFeature podpagesDocumentation "podpages")
|
|
|
|
(enableFeature txtpagesDocumentation "txtpages")
|
|
|
|
/*
|
|
|
|
* External libraries
|
|
|
|
*/
|
|
|
|
#(enableFeature avisynth "avisynth")
|
|
|
|
(enableFeature (bzip2 != null) "bzlib")
|
|
|
|
(enableFeature (celt != null) "libcelt")
|
|
|
|
#(enableFeature crystalhd "crystalhd")
|
2019-08-21 16:15:47 +02:00
|
|
|
(enableFeature (dav1d != null) "libdav1d")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature decklinkExtlib "decklink")
|
|
|
|
(enableFeature (fdkaacExtlib && gplLicensing) "libfdk-aac")
|
|
|
|
#(enableFeature (flite != null) "libflite")
|
|
|
|
"--disable-libflite" # Force disable until a solution is found
|
|
|
|
(enableFeature (fontconfig != null) "fontconfig")
|
|
|
|
(enableFeature (freetype != null) "libfreetype")
|
|
|
|
(enableFeature (frei0r != null && gplLicensing) "frei0r")
|
|
|
|
(enableFeature (fribidi != null) "libfribidi")
|
|
|
|
(enableFeature (game-music-emu != null) "libgme")
|
|
|
|
(enableFeature (gnutls != null) "gnutls")
|
|
|
|
(enableFeature (gsm != null) "libgsm")
|
|
|
|
#(enableFeature (ilbc != null) "libilbc")
|
|
|
|
(enableFeature (ladspaH !=null) "ladspa")
|
|
|
|
(enableFeature (lame != null) "libmp3lame")
|
2018-08-01 17:03:44 +02:00
|
|
|
(enableFeature (libaom != null) "libaom")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (libass != null) "libass")
|
|
|
|
#(enableFeature (libavc1394 != null) null null)
|
|
|
|
(enableFeature (libbluray != null) "libbluray")
|
|
|
|
(enableFeature (libbs2b != null) "libbs2b")
|
|
|
|
#(enableFeature (libcaca != null) "libcaca")
|
|
|
|
#(enableFeature (cdio-paranoia != null && gplLicensing) "libcdio")
|
|
|
|
(enableFeature (if isLinux then libdc1394 != null && libraw1394 != null else false) "libdc1394")
|
|
|
|
(enableFeature (libiconv != null) "iconv")
|
2019-11-27 13:51:14 +01:00
|
|
|
(enableFeature (libjack2 != null) "libjack")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature (if isLinux then libiec61883 != null && libavc1394 != null && libraw1394 != null else false) "libiec61883")
|
2019-08-23 11:01:47 +02:00
|
|
|
(enableFeature (if isLinux && !isAarch64 then libmfx != null else false) "libmfx")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (libmodplug != null) "libmodplug")
|
2018-03-26 12:35:23 +02:00
|
|
|
(enableFeature (libmysofa != null) "libmysofa")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature (libnut != null) "libnut")
|
|
|
|
(enableFeature (libopus != null) "libopus")
|
2020-06-12 06:58:35 +02:00
|
|
|
(enableFeature (librsvg != null) "librsvg")
|
2020-06-28 01:28:02 +02:00
|
|
|
(enableFeature (srt != null) "libsrt")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (libssh != null) "libssh")
|
|
|
|
(enableFeature (libtheora != null) "libtheora")
|
|
|
|
(enableFeature (if isLinux then libv4l != null else false) "libv4l2")
|
|
|
|
(enableFeature ((isLinux || isFreeBSD) && libva != null) "vaapi")
|
|
|
|
(enableFeature (libvdpau != null) "vdpau")
|
|
|
|
(enableFeature (libvorbis != null) "libvorbis")
|
2019-10-25 11:20:00 +02:00
|
|
|
(enableFeature (!isAarch64 && libvmaf != null && version3Licensing) "libvmaf")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (libvpx != null) "libvpx")
|
|
|
|
(enableFeature (libwebp != null) "libwebp")
|
2018-12-17 16:48:54 +01:00
|
|
|
(enableFeature (libX11 != null && libXv != null && libXext != null) "xlib")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (libxcb != null) "libxcb")
|
|
|
|
(enableFeature libxcbshmExtlib "libxcb-shm")
|
|
|
|
(enableFeature libxcbxfixesExtlib "libxcb-xfixes")
|
|
|
|
(enableFeature libxcbshapeExtlib "libxcb-shape")
|
2021-03-14 19:12:53 +01:00
|
|
|
(enableFeature (xz != null) "lzma")
|
2016-06-14 17:50:53 +02:00
|
|
|
(enableFeature nvenc "nvenc")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (openal != null) "openal")
|
|
|
|
#(enableFeature opencl "opencl")
|
2017-08-09 03:40:36 +02:00
|
|
|
(enableFeature (opencore-amr != null && version3Licensing) "libopencore-amrnb")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature (opencv != null) "libopencv")
|
|
|
|
(enableFeature openglExtlib "opengl")
|
|
|
|
#(enableFeature (openh264 != null) "openh264")
|
2018-05-12 11:45:22 +02:00
|
|
|
(enableFeature (openjpeg != null) "libopenjpeg")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (opensslExtlib && gplLicensing) "openssl")
|
2015-05-27 21:42:15 +02:00
|
|
|
(enableFeature (libpulseaudio != null) "libpulse")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature quvi "libquvi")
|
2020-09-09 15:52:34 +02:00
|
|
|
(enableFeature (rav1e != null) "librav1e")
|
2020-12-04 15:07:56 +01:00
|
|
|
(enableFeature (svt-av1 != null) "libsvtav1")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (rtmpdump != null) "librtmp")
|
|
|
|
#(enableFeature (schroedinger != null) "libschroedinger")
|
2017-04-07 05:12:20 +02:00
|
|
|
(enableFeature (SDL2 != null) "sdl2")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (soxr != null) "libsoxr")
|
|
|
|
(enableFeature (speex != null) "libspeex")
|
|
|
|
#(enableFeature (twolame != null) "libtwolame")
|
|
|
|
#(enableFeature (utvideo != null && gplLicensing) "libutvideo")
|
|
|
|
(enableFeature (vid-stab != null && gplLicensing) "libvidstab") # Actual min. version 2.0
|
|
|
|
#(enableFeature (vo-aacenc != null && version3Licensing) "libvo-aacenc")
|
2018-04-17 17:41:47 +02:00
|
|
|
(enableFeature (vo-amrwbenc != null && version3Licensing) "libvo-amrwbenc")
|
2015-04-07 09:34:27 +02:00
|
|
|
(enableFeature (x264 != null && gplLicensing) "libx264")
|
|
|
|
(enableFeature (x265 != null && gplLicensing) "libx265")
|
|
|
|
(enableFeature (xavs != null && gplLicensing) "libxavs")
|
|
|
|
(enableFeature (xvidcore != null && gplLicensing) "libxvid")
|
|
|
|
(enableFeature (zeromq4 != null) "libzmq")
|
|
|
|
(enableFeature (zlib != null) "zlib")
|
2021-04-24 16:36:06 +02:00
|
|
|
(enableFeature (isLinux && vulkan-loader != null) "vulkan")
|
2021-05-20 07:49:57 +02:00
|
|
|
(enableFeature (isLinux && vulkan-loader != null && glslang != null) "libglslang")
|
2015-04-07 09:34:27 +02:00
|
|
|
#(enableFeature (zvbi != null && gplLicensing) "libzvbi")
|
|
|
|
/*
|
|
|
|
* Developer flags
|
|
|
|
*/
|
|
|
|
(enableFeature debugDeveloper "debug")
|
|
|
|
(enableFeature optimizationsDeveloper "optimizations")
|
|
|
|
(enableFeature extraWarningsDeveloper "extra-warnings")
|
|
|
|
(enableFeature strippingDeveloper "stripping")
|
2018-05-10 07:38:51 +02:00
|
|
|
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"--cross-prefix=${stdenv.cc.targetPrefix}"
|
|
|
|
"--enable-cross-compile"
|
2021-05-20 07:49:57 +02:00
|
|
|
] ++ optionals stdenv.cc.isClang [
|
|
|
|
"--cc=clang"
|
|
|
|
"--cxx=clang++"
|
2015-04-07 09:34:27 +02:00
|
|
|
];
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ addOpenGLRunpath perl pkg-config texinfo yasm ];
|
2015-04-07 09:34:27 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
2019-08-21 16:15:47 +02:00
|
|
|
bzip2 celt dav1d fontconfig freetype frei0r fribidi game-music-emu gnutls gsm
|
2018-08-01 17:03:44 +02:00
|
|
|
libjack2 ladspaH lame libaom libass libbluray libbs2b libcaca libdc1394 libmodplug libmysofa
|
2020-06-12 06:58:35 +02:00
|
|
|
libogg libopus librsvg libssh libtheora libvdpau libvorbis libvpx libwebp libX11
|
2021-03-14 19:12:53 +01:00
|
|
|
libxcb libXv libXext xz openal openjpeg libpulseaudio rav1e svt-av1 rtmpdump opencore-amr
|
2021-04-10 10:30:54 +02:00
|
|
|
samba SDL2 soxr speex srt vid-stab vo-amrwbenc x264 x265 xavs xvidcore
|
2021-05-20 07:49:57 +02:00
|
|
|
zeromq4 zlib
|
2019-11-10 17:44:34 +01:00
|
|
|
] ++ optionals openglExtlib [ libGL libGLU ]
|
2017-01-25 03:35:42 +01:00
|
|
|
++ optionals nonfreeLicensing [ fdk_aac openssl ]
|
2015-04-07 09:34:27 +02:00
|
|
|
++ optional ((isLinux || isFreeBSD) && libva != null) libva
|
2019-10-25 11:20:00 +02:00
|
|
|
++ optional (!isAarch64 && libvmaf != null && version3Licensing) libvmaf
|
2021-05-20 07:49:57 +02:00
|
|
|
++ optionals isLinux [ alsaLib libraw1394 libv4l vulkan-loader glslang ]
|
2019-08-23 11:01:47 +02:00
|
|
|
++ optional (isLinux && !isAarch64 && libmfx != null) libmfx
|
2019-05-09 19:36:40 +02:00
|
|
|
++ optional nvenc nv-codec-headers
|
2017-02-02 14:47:01 +01:00
|
|
|
++ optionals stdenv.isDarwin [ Cocoa CoreServices CoreAudio AVFoundation
|
2017-10-31 01:33:14 +01:00
|
|
|
MediaToolbox VideoDecodeAcceleration
|
2019-06-19 20:01:18 +02:00
|
|
|
libiconv ];
|
2015-04-07 09:34:27 +02:00
|
|
|
|
2019-05-11 11:08:31 +02:00
|
|
|
buildFlags = [ "all" ]
|
|
|
|
++ optional qtFaststartProgram "tools/qt-faststart"; # Build qt-faststart executable
|
2016-03-11 21:12:55 +01:00
|
|
|
|
|
|
|
# Hacky framework patching technique borrowed from the phantomjs2 package
|
|
|
|
postInstall = optionalString qtFaststartProgram ''
|
|
|
|
cp -a tools/qt-faststart $out/bin/
|
|
|
|
'';
|
|
|
|
|
2020-05-11 11:09:45 +02:00
|
|
|
postFixup = optionalString stdenv.isLinux ''
|
|
|
|
# Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found.
|
|
|
|
# See the explanation in addOpenGLRunpath.
|
|
|
|
addOpenGLRunpath $out/lib/libavcodec.so
|
|
|
|
addOpenGLRunpath $out/lib/libavutil.so
|
|
|
|
'';
|
|
|
|
|
2015-04-07 09:34:27 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
meta = with lib; {
|
2015-04-07 09:34:27 +02:00
|
|
|
description = "A complete, cross-platform solution to record, convert and stream audio and video";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.ffmpeg.org/";
|
2021-04-10 10:30:54 +02:00
|
|
|
changelog = "https://github.com/FFmpeg/FFmpeg/blob/n${version}/Changelog";
|
2015-04-07 09:34:27 +02:00
|
|
|
longDescription = ''
|
2017-02-02 14:47:01 +01:00
|
|
|
FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
|
|
|
|
mux, demux, stream, filter and play pretty much anything that humans and machines
|
|
|
|
have created. It supports the most obscure ancient formats up to the cutting edge.
|
|
|
|
No matter if they were designed by some standards committee, the community or
|
|
|
|
a corporation.
|
2015-04-07 09:34:27 +02:00
|
|
|
'';
|
|
|
|
license = (
|
|
|
|
if nonfreeLicensing then
|
|
|
|
licenses.unfreeRedistributable
|
|
|
|
else if version3Licensing then
|
|
|
|
licenses.gpl3
|
|
|
|
else if gplLicensing then
|
|
|
|
licenses.gpl2Plus
|
|
|
|
else
|
|
|
|
licenses.lgpl21Plus
|
|
|
|
);
|
|
|
|
platforms = platforms.all;
|
2019-12-05 08:29:48 +01:00
|
|
|
maintainers = with maintainers; [ codyopel ];
|
2015-04-07 09:34:27 +02:00
|
|
|
};
|
|
|
|
}
|