2022-02-10 20:34:41 +00:00
{ lib , stdenv , buildPackages , ffmpeg , addOpenGLRunpath , pkg-config , perl , texinfo , yasm
2020-04-24 23:36:52 +00: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
, version3Licensing ? true # (L)GPL3: libvmaf,opencore-amrnb,opencore-amrwb,samba,vo-aacenc,vo-amrwbenc
, nonfreeLicensing ? false # NONFREE: openssl,fdkaac,blackmagic-design-desktop-video
/*
* 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
, enableLto ? false # build with link-time optimization
/*
* 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
, 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
* /
2021-06-28 23:13:55 +00:00
, alsa-lib ? null # Alsa in/output support
2020-04-24 23:36:52 +00:00
#, avisynth ? null # Support for reading AviSynth scripts
, bzip2 ? null
, celt ? null # CELT decoder
#, crystalhd ? null # Broadcom CrystalHD hardware acceleration
, dav1d ? null # AV1 decoder (focused on speed and correctness)
#, 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
, libjack2 ? null # Jack audio (only version 2 is supported in this build)
, ladspaH ? null # LADSPA audio filtering
, lame ? null # LAME MP3 encoder
, libass ? null # (Advanced) SubStation Alpha subtitle rendering
, libaom ? null # AV1 encoder
, 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)
2021-08-05 21:33:18 +00:00
, libdrm ? null # libdrm support
2020-04-24 23:36:52 +00:00
, libiconv ? null
#, libiec61883 ? null, libavc1394 ? null # iec61883 (also uses libraw1394)
, libmfx ? null # Hardware acceleration vis libmfx
, libmodplug ? null # ModPlug support
, libmysofa ? null # HRTF support via SOFAlizer
#, libnut ? null # NUT (de)muxer, native (de)muser exists
, libogg ? null # Ogg container used by vorbis & theora
, libopus ? null # Opus de/encoder
2020-06-18 07:06:33 +00:00
, librsvg ? null # SVG protocol
2020-04-24 23:36:52 +00: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
, libvmaf ? null # Netflix's VMAF (Video Multi-Method Assessment Fusion)
, 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
, libXext ? null # Xlib support
2022-02-10 20:34:41 +00:00
, libxml2 ? null # libxml2 support, for IMF and DASH demuxers
2021-04-05 15:23:46 +00:00
, xz ? null # xz-utils
2020-04-24 23:36:52 +00:00
, nvenc ? ! stdenv . isDarwin && ! stdenv . isAarch64 , nv-codec-headers ? null # NVIDIA NVENC support
, openal ? null # OpenAL 1.1 capture support
#, opencl ? null # OpenCL code
, opencore-amr ? null # AMR-NB de/encoder & AMR-WB decoder
#, opencv ? null # Video filtering
, openglExtlib ? false , libGL ? null , libGLU ? null # OpenGL rendering
2022-02-10 20:34:41 +00:00
, openh264 ? null # H.264/AVC encoder
2020-04-24 23:36:52 +00:00
, openjpeg ? null # JPEG 2000 de/encoder
, opensslExtlib ? false , openssl ? null
, libpulseaudio ? null # Pulseaudio input support
2020-09-25 04:45:31 +00:00
, rav1e ? null # AV1 encoder (focused on speed and safety)
2021-01-09 10:05:03 +00:00
, svt-av1 ? null # AV1 encoder/decoder (focused on speed and correctness)
2020-04-24 23:36:52 +00:00
, rtmpdump ? null # RTMP[E] support
#, libquvi ? null # Quvi input support
, samba ? null # Samba protocol
#, schroedinger ? null # Dirac de/encoder
, SDL2 ? null
#, shine ? null # Fixed-point MP3 encoder
, soxr ? null # Resampling via soxr
, speex ? null # Speex de/encoder
2020-07-18 16:06:22 +00:00
, srt ? null # Secure Reliable Transport (SRT) protocol
2020-04-24 23:36:52 +00:00
#, twolame ? null # MP2 encoder
#, utvideo ? null # Ut Video de/encoder
, vid-stab ? null # Video stabilization
#, vo-aacenc ? null # AAC encoder
, vo-amrwbenc ? null # AMR-WB encoder
, 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
2022-01-26 04:04:25 +00:00
, zimg ? null
2020-04-24 23:36:52 +00:00
, zlib ? null
2021-05-20 23:08:51 +00:00
, vulkan-loader ? null
, glslang ? null
2020-04-24 23:36:52 +00:00
#, zvbi ? null # Teletext support
/*
* Developer options
* /
, debugDeveloper ? false
, optimizationsDeveloper ? true
, extraWarningsDeveloper ? false
, strippingDeveloper ? false
/*
* Darwin frameworks
* /
, Cocoa , CoreAudio , CoreServices , AVFoundation , MediaToolbox
, VideoDecodeAcceleration
} :
/* M a i n t a i n e r n o t e s :
*
* 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
2022-02-10 20:34:41 +00:00
* libnut libquvi nvenc opencl oss shine twolame
2020-04-24 23:36:52 +00:00
* utvideo vo-aacenc vo-amrwbenc xvmc zvbi blackmagic-design-desktop-video
*
* Need fixes to support Darwin :
2020-12-07 07:45:13 +00:00
* gsm libjack2 libmodplug libmfx ( intel-media-sdk ) nvenc pulseaudio samba
* vid-stab
2020-04-24 23:36:52 +00:00
*
* Need fixes to support AArch64 :
* libmfx ( intel-media-sdk ) nvenc
*
* 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
inherit ( stdenv ) isCygwin isDarwin isFreeBSD isLinux isAarch64 ;
2021-02-05 17:12:51 +00:00
inherit ( lib ) optional optionals optionalString enableFeature ;
2020-04-24 23:36:52 +00:00
in
/*
* Licensing dependencies
* /
assert version3Licensing -> gplLicensing ;
assert nonfreeLicensing -> gplLicensing && version3Licensing ;
/*
* Build dependencies
* /
assert networkBuild -> gnutls != null || opensslExtlib ;
assert pixelutilsBuild -> avutilLibrary ;
/*
* Platform dependencies
* /
assert isDarwin -> ! nvenc ;
/*
* Program dependencies
* /
assert ffmpegProgram -> avcodecLibrary
&& avfilterLibrary
&& avformatLibrary
&& swresampleLibrary ;
assert ffplayProgram -> avcodecLibrary
&& avformatLibrary
&& swscaleLibrary
&& swresampleLibrary
&& SDL2 != null ;
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 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 ;
assert openglExtlib -> libGL != null && libGLU != null ;
assert opensslExtlib -> gnutls == null && openssl != null && nonfreeLicensing ;
stdenv . mkDerivation rec {
pname = " f f m p e g - f u l l " ;
2021-09-18 10:52:07 +00:00
inherit ( ffmpeg ) src version patches ;
2020-04-24 23:36:52 +00:00
prePatch = ''
patchShebangs .
2021-02-05 17:12:51 +00:00
'' + l i b . o p t i o n a l S t r i n g s t d e n v . i s D a r w i n ''
2020-04-24 23:36:52 +00:00
sed - i ' s / #ifndef __MAC_10_11/#if 1/' ./libavcodec/audiotoolboxdec.c
2021-02-05 17:12:51 +00:00
'' + l i b . o p t i o n a l S t r i n g ( f r e i 0 r ! = n u l l ) ''
2020-04-24 23:36:52 +00: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
'' ;
configurePlatforms = [ ] ;
configureFlags = [
2022-02-10 20:34:41 +00:00
" - - t a r g e t _ o s = ${ if stdenv . hostPlatform . isMinGW then " m i n g w 6 4 " else stdenv . hostPlatform . parsed . kernel . name } " #mingw32 and mingw64 doesn't have a difference here, it is internally rewritten as mingw32
2020-04-24 23:36:52 +00:00
" - - a r c h = ${ stdenv . hostPlatform . parsed . cpu . name } "
/*
* Licensing flags
* /
( enableFeature gplLicensing " g p l " )
( enableFeature version3Licensing " v e r s i o n 3 " )
( enableFeature nonfreeLicensing " n o n f r e e " )
/*
* Build flags
* /
# On some ARM platforms --enable-thumb
" - - e n a b l e - s h a r e d "
( enableFeature true " p i c " )
( enableFeature smallBuild " s m a l l " )
( enableFeature runtimeCpuDetectBuild " r u n t i m e - c p u d e t e c t " )
( enableFeature enableLto " l t o " )
( enableFeature grayBuild " g r a y " )
( enableFeature swscaleAlphaBuild " s w s c a l e - a l p h a " )
( enableFeature hardcodedTablesBuild " h a r d c o d e d - t a b l e s " )
( enableFeature safeBitstreamReaderBuild " s a f e - b i t s t r e a m - r e a d e r " )
( if multithreadBuild then (
2022-02-10 20:34:41 +00:00
if stdenv . hostPlatform . isWindows then
2020-04-24 23:36:52 +00:00
" - - d i s a b l e - p t h r e a d s - - e n a b l e - w 3 2 t h r e a d s "
else # Use POSIX threads by default
" - - e n a b l e - p t h r e a d s - - d i s a b l e - w 3 2 t h r e a d s " )
else
" - - d i s a b l e - p t h r e a d s - - d i s a b l e - w 3 2 t h r e a d s " )
" - - d i s a b l e - o s 2 t h r e a d s " # We don't support OS/2
( enableFeature networkBuild " n e t w o r k " )
( enableFeature pixelutilsBuild " p i x e l u t i l s " )
/*
* Program flags
* /
( enableFeature ffmpegProgram " f f m p e g " )
( enableFeature ffplayProgram " f f p l a y " )
( enableFeature ffprobeProgram " f f p r o b e " )
/*
* Library flags
* /
( enableFeature avcodecLibrary " a v c o d e c " )
( enableFeature avdeviceLibrary " a v d e v i c e " )
( enableFeature avfilterLibrary " a v f i l t e r " )
( enableFeature avformatLibrary " a v f o r m a t " )
( enableFeature avutilLibrary " a v u t i l " )
( enableFeature ( postprocLibrary && gplLicensing ) " p o s t p r o c " )
( enableFeature swresampleLibrary " s w r e s a m p l e " )
( enableFeature swscaleLibrary " s w s c a l e " )
/*
* Documentation flags
* /
( enableFeature ( htmlpagesDocumentation
|| manpagesDocumentation
|| podpagesDocumentation
|| txtpagesDocumentation ) " d o c " )
( enableFeature htmlpagesDocumentation " h t m l p a g e s " )
( enableFeature manpagesDocumentation " m a n p a g e s " )
( enableFeature podpagesDocumentation " p o d p a g e s " )
( enableFeature txtpagesDocumentation " t x t p a g e s " )
/*
* External libraries
* /
#(enableFeature avisynth "avisynth")
( enableFeature ( bzip2 != null ) " b z l i b " )
( enableFeature ( celt != null ) " l i b c e l t " )
#(enableFeature crystalhd "crystalhd")
( enableFeature ( dav1d != null ) " l i b d a v 1 d " )
#(enableFeature decklinkExtlib "decklink")
( enableFeature ( fdkaacExtlib && gplLicensing ) " l i b f d k - a a c " )
#(enableFeature (flite != null) "libflite")
" - - d i s a b l e - l i b f l i t e " # Force disable until a solution is found
( enableFeature ( fontconfig != null ) " f o n t c o n f i g " )
( enableFeature ( freetype != null ) " l i b f r e e t y p e " )
( enableFeature ( frei0r != null && gplLicensing ) " f r e i 0 r " )
( enableFeature ( fribidi != null ) " l i b f r i b i d i " )
( enableFeature ( game-music-emu != null ) " l i b g m e " )
( enableFeature ( gnutls != null ) " g n u t l s " )
( enableFeature ( gsm != null ) " l i b g s m " )
#(enableFeature (ilbc != null) "libilbc")
( enableFeature ( ladspaH != null ) " l a d s p a " )
( enableFeature ( lame != null ) " l i b m p 3 l a m e " )
( enableFeature ( libaom != null ) " l i b a o m " )
( enableFeature ( libass != null ) " l i b a s s " )
#(enableFeature (libavc1394 != null) null null)
( enableFeature ( libbluray != null ) " l i b b l u r a y " )
( enableFeature ( libbs2b != null ) " l i b b s 2 b " )
#(enableFeature (libcaca != null) "libcaca")
#(enableFeature (cdio-paranoia != null && gplLicensing) "libcdio")
( enableFeature ( if isLinux then libdc1394 != null && libraw1394 != null else false ) " l i b d c 1 3 9 4 " )
2021-08-05 21:33:18 +00:00
( enableFeature ( ( isLinux || isFreeBSD ) && libdrm != null ) " l i b d r m " )
2020-04-24 23:36:52 +00:00
( enableFeature ( libiconv != null ) " i c o n v " )
( enableFeature ( libjack2 != null ) " l i b j a c k " )
#(enableFeature (if isLinux then libiec61883 != null && libavc1394 != null && libraw1394 != null else false) "libiec61883")
( enableFeature ( if isLinux && ! isAarch64 then libmfx != null else false ) " l i b m f x " )
( enableFeature ( libmodplug != null ) " l i b m o d p l u g " )
( enableFeature ( libmysofa != null ) " l i b m y s o f a " )
#(enableFeature (libnut != null) "libnut")
( enableFeature ( libopus != null ) " l i b o p u s " )
2020-06-18 07:06:33 +00:00
( enableFeature ( librsvg != null ) " l i b r s v g " )
2020-07-18 16:06:22 +00:00
( enableFeature ( srt != null ) " l i b s r t " )
2020-04-24 23:36:52 +00:00
( enableFeature ( libssh != null ) " l i b s s h " )
( enableFeature ( libtheora != null ) " l i b t h e o r a " )
( enableFeature ( if isLinux then libv4l != null else false ) " l i b v 4 l 2 " )
( enableFeature ( ( isLinux || isFreeBSD ) && libva != null ) " v a a p i " )
( enableFeature ( libvdpau != null ) " v d p a u " )
( enableFeature ( libvorbis != null ) " l i b v o r b i s " )
( enableFeature ( ! isAarch64 && libvmaf != null && version3Licensing ) " l i b v m a f " )
( enableFeature ( libvpx != null ) " l i b v p x " )
( enableFeature ( libwebp != null ) " l i b w e b p " )
( enableFeature ( libX11 != null && libXv != null && libXext != null ) " x l i b " )
( enableFeature ( libxcb != null ) " l i b x c b " )
( enableFeature libxcbshmExtlib " l i b x c b - s h m " )
( enableFeature libxcbxfixesExtlib " l i b x c b - x f i x e s " )
( enableFeature libxcbshapeExtlib " l i b x c b - s h a p e " )
2022-02-10 20:34:41 +00:00
( enableFeature ( libxml2 != null ) " l i b x m l 2 " )
2021-04-05 15:23:46 +00:00
( enableFeature ( xz != null ) " l z m a " )
2020-04-24 23:36:52 +00:00
( enableFeature nvenc " n v e n c " )
( enableFeature ( openal != null ) " o p e n a l " )
#(enableFeature opencl "opencl")
( enableFeature ( opencore-amr != null && version3Licensing ) " l i b o p e n c o r e - a m r n b " )
#(enableFeature (opencv != null) "libopencv")
( enableFeature openglExtlib " o p e n g l " )
2022-02-10 20:34:41 +00:00
( enableFeature ( openh264 != null ) " l i b o p e n h 2 6 4 " )
2020-04-24 23:36:52 +00:00
( enableFeature ( openjpeg != null ) " l i b o p e n j p e g " )
( enableFeature ( opensslExtlib && gplLicensing ) " o p e n s s l " )
( enableFeature ( libpulseaudio != null ) " l i b p u l s e " )
#(enableFeature quvi "libquvi")
2020-09-25 04:45:31 +00:00
( enableFeature ( rav1e != null ) " l i b r a v 1 e " )
2021-01-09 10:05:03 +00:00
( enableFeature ( svt-av1 != null ) " l i b s v t a v 1 " )
2020-04-24 23:36:52 +00:00
( enableFeature ( rtmpdump != null ) " l i b r t m p " )
#(enableFeature (schroedinger != null) "libschroedinger")
( enableFeature ( SDL2 != null ) " s d l 2 " )
( enableFeature ( soxr != null ) " l i b s o x r " )
( enableFeature ( speex != null ) " l i b s p e e x " )
#(enableFeature (twolame != null) "libtwolame")
#(enableFeature (utvideo != null && gplLicensing) "libutvideo")
( enableFeature ( vid-stab != null && gplLicensing ) " l i b v i d s t a b " ) # Actual min. version 2.0
#(enableFeature (vo-aacenc != null && version3Licensing) "libvo-aacenc")
( enableFeature ( vo-amrwbenc != null && version3Licensing ) " l i b v o - a m r w b e n c " )
( enableFeature ( x264 != null && gplLicensing ) " l i b x 2 6 4 " )
( enableFeature ( x265 != null && gplLicensing ) " l i b x 2 6 5 " )
( enableFeature ( xavs != null && gplLicensing ) " l i b x a v s " )
( enableFeature ( xvidcore != null && gplLicensing ) " l i b x v i d " )
( enableFeature ( zeromq4 != null ) " l i b z m q " )
2022-01-26 04:04:25 +00:00
( enableFeature ( zimg != null ) " l i b z i m g " )
2020-04-24 23:36:52 +00:00
( enableFeature ( zlib != null ) " z l i b " )
2021-05-20 23:08:51 +00:00
( enableFeature ( isLinux && vulkan-loader != null ) " v u l k a n " )
( enableFeature ( isLinux && vulkan-loader != null && glslang != null ) " l i b g l s l a n g " )
2021-08-12 14:41:47 +00:00
( enableFeature ( samba != null && gplLicensing && version3Licensing ) " l i b s m b c l i e n t " )
2020-04-24 23:36:52 +00:00
#(enableFeature (zvbi != null && gplLicensing) "libzvbi")
/*
* Developer flags
* /
( enableFeature debugDeveloper " d e b u g " )
( enableFeature optimizationsDeveloper " o p t i m i z a t i o n s " )
( enableFeature extraWarningsDeveloper " e x t r a - w a r n i n g s " )
( enableFeature strippingDeveloper " s t r i p p i n g " )
] ++ optionals ( stdenv . hostPlatform != stdenv . buildPlatform ) [
" - - c r o s s - p r e f i x = ${ stdenv . cc . targetPrefix } "
" - - e n a b l e - c r o s s - c o m p i l e "
2022-02-10 20:34:41 +00:00
" - - h o s t - c c = ${ buildPackages . stdenv . cc } / b i n / c c "
2021-05-20 23:08:51 +00:00
] ++ optionals stdenv . cc . isClang [
" - - c c = c l a n g "
" - - c x x = c l a n g + + "
2020-04-24 23:36:52 +00:00
] ;
2021-02-05 17:12:51 +00:00
nativeBuildInputs = [ addOpenGLRunpath perl pkg-config texinfo yasm ] ;
2020-04-24 23:36:52 +00:00
buildInputs = [
bzip2 celt dav1d fontconfig freetype frei0r fribidi game-music-emu gnutls gsm
libjack2 ladspaH lame libaom libass libbluray libbs2b libcaca libdc1394 libmodplug libmysofa
2020-06-18 07:06:33 +00:00
libogg libopus librsvg libssh libtheora libvdpau libvorbis libvpx libwebp libX11
2022-02-10 20:34:41 +00:00
libxcb libXv libXext libxml2 xz openal openjpeg libpulseaudio rav1e svt-av1 rtmpdump opencore-amr
2021-05-20 23:08:51 +00:00
samba SDL2 soxr speex srt vid-stab vo-amrwbenc x264 x265 xavs xvidcore
2022-02-10 20:34:41 +00:00
zeromq4 zimg zlib openh264
2020-04-24 23:36:52 +00:00
] ++ optionals openglExtlib [ libGL libGLU ]
++ optionals nonfreeLicensing [ fdk_aac openssl ]
++ optional ( ( isLinux || isFreeBSD ) && libva != null ) libva
2021-08-05 21:33:18 +00:00
++ optional ( ( isLinux || isFreeBSD ) && libdrm != null ) libdrm
2020-04-24 23:36:52 +00:00
++ optional ( ! isAarch64 && libvmaf != null && version3Licensing ) libvmaf
2021-06-28 23:13:55 +00:00
++ optionals isLinux [ alsa-lib libraw1394 libv4l vulkan-loader glslang ]
2020-04-24 23:36:52 +00:00
++ optional ( isLinux && ! isAarch64 && libmfx != null ) libmfx
++ optional nvenc nv-codec-headers
++ optionals stdenv . isDarwin [ Cocoa CoreServices CoreAudio AVFoundation
MediaToolbox VideoDecodeAcceleration
libiconv ] ;
buildFlags = [ " a l l " ]
++ optional qtFaststartProgram " t o o l s / q t - f a s t s t a r t " ; # Build qt-faststart executable
2021-09-18 10:52:07 +00:00
doCheck = true ;
checkPhase = let
ldLibraryPathEnv = if stdenv . isDarwin then " D Y L D _ L I B R A R Y _ P A T H " else " L D _ L I B R A R Y _ P A T H " ;
in ''
2022-02-10 20:34:41 +00:00
$ { ldLibraryPathEnv } = " l i b a v c o d e c : l i b a v d e v i c e : l i b a v f i l t e r : l i b a v f o r m a t : l i b a v u t i l : l i b p o s t p r o c : l i b s w r e s a m p l e : l i b s w s c a l e : ' ' ${ $ { ldLibraryPathEnv } } " \
2021-09-18 10:52:07 +00:00
make check - j $ NIX_BUILD_CORES
'' ;
2020-04-24 23:36:52 +00:00
# Hacky framework patching technique borrowed from the phantomjs2 package
postInstall = optionalString qtFaststartProgram ''
cp - a tools/qt-faststart $ out/bin /
'' ;
2020-05-29 06:06:01 +00: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
'' ;
2020-04-24 23:36:52 +00:00
enableParallelBuilding = true ;
2021-02-05 17:12:51 +00:00
meta = with lib ; {
2020-04-24 23:36:52 +00:00
description = " A c o m p l e t e , c r o s s - p l a t f o r m s o l u t i o n t o r e c o r d , c o n v e r t a n d s t r e a m a u d i o a n d v i d e o " ;
homepage = " h t t p s : / / w w w . f f m p e g . o r g / " ;
2021-05-20 23:08:51 +00:00
changelog = " h t t p s : / / g i t h u b . c o m / F F m p e g / F F m p e g / b l o b / n ${ version } / C h a n g e l o g " ;
2020-04-24 23:36:52 +00:00
longDescription = ''
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 .
'' ;
license = (
if nonfreeLicensing then
licenses . unfreeRedistributable
else if version3Licensing then
licenses . gpl3
else if gplLicensing then
licenses . gpl2Plus
else
licenses . lgpl21Plus
) ;
platforms = platforms . all ;
maintainers = with maintainers ; [ codyopel ] ;
} ;
}