11class FfmpegCustom < Formula
22 desc "Play, record, convert, and stream audio and video"
33 homepage "https://ffmpeg.org/"
4- url "https://ffmpeg.org/releases/ffmpeg-8.0.tar.xz"
5- sha256 "b2751fccb6cc4c77708113cd78b561059b6fa904b24162fa0be2d60273d27b8e "
4+ url "https://ffmpeg.org/releases/ffmpeg-8.0.1. tar.xz"
5+ sha256 "05ee0b03119b45c0bdb4df654b96802e909e0a752f72e4fe3794f487229e5a41 "
66 license "GPL-2.0-or-later"
7- revision 1
87 head "https://github.com/FFmpeg/FFmpeg.git" , branch : "master"
98
109 livecheck do
1110 url "https://ffmpeg.org/download.html"
1211 regex ( /href=.*?ffmpeg[._-]v?(\d +(?:\. \d +)+)\. t/i )
1312 end
1413
15- bottle do
16- root_url "https://github.com/PatTheMav/homebrew-custom/releases/download/ffmpeg-custom-8.0_1"
17- sha256 arm64_sequoia : "2808ba142096df3e0f27a7de44f214ea8c1b3935f8fde6326763786d5763ac29"
18- sha256 arm64_sonoma : "a725b94d9aba752450c9512c5ad1ba825253e3137189afde6230a33bd307e1fe"
19- sha256 x86_64_linux : "e9b413f7130bd0f94d8e7e251c7defb13edd07587f4f0617ff841aa52a003fcb"
20- end
21-
22- option "with-chromaprint" , "Enable the Chromaprint audio fingerprinting library"
23- option "with-decklink" , "Enable DeckLink support"
24- option "with-fdk-aac" , "Enable the Fraunhofer FDK AAC library"
25- option "with-game-music-emu" , "Enable Game Music Emu (GME) support"
14+ # Default in Homebrew-core, optional here
15+ option "with-aom" , "Enable AOM AV1 video codec"
16+ option "with-aribb24" , "Enable ARIB STD-824 decoder library"
17+ option "with-dav1d" , "Enable Dav1d AV1 video codec"
18+ option "with-frei0r" , "Enable frei0r video effect plugin API support"
2619 option "with-harfbuzz" , "Enable harfbuzz libbrary"
27- option "with-librsvg" , "Enable SVG files as inputs via librsvg"
20+ option "with-jpegxl" , "Enable Jpeg-XL support"
21+ option "with-libass" , "Enable ASS/SSA subtitle format"
22+ option "with-libbluray" , "Enable libbluray supoort"
2823 option "with-libsoxr" , "Enable the soxr resample library"
2924 option "with-libssh" , "Enable SFTP protocol via libssh"
30- option "with-tesseract" , "Enable the tesseract OCR engine"
3125 option "with-libvidstab" , "Enable vid.stab support for video stabilization"
26+ option "with-libvmaf" , "Enable libvmaf scoring library"
27+ option "with-libvorbis" , "Enable vorbis codec"
28+ option "with-libvpx" , "Enable vpx video codec"
3229 option "with-opencore-amr" , "Enable Opencore AMR NR/WB audio format"
33- option "with-openh264" , "Enable OpenH264 library"
3430 option "with-openjpeg" , "Enable JPEG 2000 image format"
35- option "with-openssl" , "Enable SSL support"
3631 option "with-rav1e" , "Enable Rav1e AV1 encoder"
3732 option "with-rubberband" , "Enable rubberband library"
33+ option "with-snappy" , "Enable snappy codec"
34+ option "with-speex" , "Enable speex codec"
35+ option "with-srt" , "Enable SRT library"
3836 option "with-svt-av1" , "Enable SVT-AV1 encoder"
37+ option "with-tesseract" , "Enable the tesseract OCR engine"
38+ option "with-theora" , "Enable theora codec"
3939 option "with-webp" , "Enable using libwebp to encode WEBP images"
40+ option "with-xvid" , "Enable Xvid codec"
4041 option "with-zeromq" , "Enable using libzeromq to receive commands sent through a libzeromq client"
4142 option "with-zimg" , "Enable z.lib zimg library"
42- option "with-srt" , "Enable SRT library"
43- option "with-librist" , "Enable rist support"
44- option "with-libvmaf" , "Enable libvmaf scoring library"
45- option "with-libxml2" , "Enable libxml2 library"
4643
47- # Default in other Homebrew distros, optional here
48- option "with-aom" , "Enable AOM AV1 video codec"
49- option "with-dav1d" , "Enable Dav1d AV1 video codec"
50- option "with-libass" , "Enable ASS/SSA subtitle format"
44+ # Bonus features
45+ option "with-fdk-aac" , "Enable the Fraunhofer FDK AAC library"
46+ option "with-game-music-emu" , "Enable Game Music Emu (GME) support"
47+ option "with-openh264" , "Enable OpenH264 library"
48+ option "with-twolame" , "Enable two-lame MP2 encoder"
5149
5250 depends_on "pkg-config" => :build
51+
5352 depends_on "lame"
54- depends_on "libvorbis"
55- depends_on "libvpx"
5653 depends_on "opus"
5754 depends_on "sdl2"
58- depends_on "snappy"
59- depends_on "theora"
6055 depends_on "x264"
6156 depends_on "x265"
62- depends_on "xz"
57+
6358 depends_on "aom" => :optional
59+ depends_on "aribb24" => :optional
6460 depends_on "dav1d" => :optional
6561 depends_on "fdk-aac" => :optional
66- depends_on "fontconfig" => :optional
67- depends_on "freetype" => :optional
6862 depends_on "frei0r" => :optional
6963 depends_on "game-music-emu" => :optional
7064 depends_on "harfbuzz" => :optional
65+ depends_on "jpeg-xl" => :optional
7166 depends_on "libass" => :optional
7267 depends_on "libbluray" => :optional
73- depends_on "libbs2b" => :optional
74- depends_on "libcaca" => :optional
75- depends_on "libgsm" => :optional
76- depends_on "libmodplug" => :optional
77- depends_on "librist" => :optional
78- depends_on "librsvg" => :optional
7968 depends_on "libsoxr" => :optional
8069 depends_on "libssh" => :optional
8170 depends_on "libvidstab" => :optional
8271 depends_on "libvmaf" => :optional
83- depends_on "libxml2" => :optional
72+ depends_on "libvorbis" => :optional
73+ depends_on "libvpx" => :optional
8474 depends_on "opencore-amr" => :optional
8575 depends_on "openh264" => :optional
8676 depends_on "openjpeg" => :optional
87- depends_on "openssl@1.1" => :optional
8877 depends_on "rav1e" => :optional
8978 depends_on "rubberband" => :optional
79+ depends_on "snappy" => :optional
9080 depends_on "speex" => :optional
9181 depends_on "srt" => :optional
9282 depends_on "svt-av1" => :optional
9383 depends_on "tesseract" => :optional
84+ depends_on "theora" => :optional
9485 depends_on "two-lame" => :optional
95- depends_on "wavpack" => :optional
9686 depends_on "webp" => :optional
9787 depends_on "xvid" => :optional
9888 depends_on "zeromq" => :optional
@@ -102,17 +92,10 @@ class FfmpegCustom < Formula
10292 uses_from_macos "libxml2"
10393 uses_from_macos "zlib"
10494
105- on_macos do
106- depends_on "libogg"
107- end
108-
10995 on_linux do
11096 depends_on "alsa-lib"
111- depends_on "gcc"
112- depends_on "libx11"
11397 depends_on "libxcb"
114- depends_on "libxext"
115- depends_on "libxv" # because rubberband is compiled with gcc
98+ depends_on "xz"
11699 end
117100
118101 on_intel do
@@ -122,8 +105,6 @@ class FfmpegCustom < Formula
122105 conflicts_with "ffmpeg" ,
123106 because : "ffmpeg-custom and ffmpeg both install ffmpeg binary"
124107
125- fails_with gcc : "5"
126-
127108 # Fix for QtWebEngine, do not remove
128109 # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270209
129110 patch do
@@ -132,7 +113,7 @@ class FfmpegCustom < Formula
132113 end
133114
134115 def install
135- ENV . append "LDFLAGS" , "-Wl,-ld_classic" if DevelopmentTools . clang_build_version >= 1500
116+ ENV . append "LDFLAGS" , "-Wl,-ld_classic" if DevelopmentTools . ld64_version . between? ( "1015.7" , "1022.1" )
136117
137118 args = %W[
138119 --prefix=#{ prefix }
@@ -144,74 +125,58 @@ def install
144125 --host-ldflags=#{ ENV . ldflags }
145126 --enable-ffplay
146127 --enable-gpl
147- --enable-demuxer=dash
148128 --enable-libmp3lame
149129 --enable-libopus
150- --enable-libsnappy
151- --enable-libtheora
152- --enable-libvorbis
153- --enable-libvpx
154130 --enable-libx264
155131 --enable-libx265
156- --enable-lzma
157- --disable-libjack
158- --disable-indev=jack
159132 ]
160133
161- if OS . mac?
162- args << "--enable-opencl"
163- args << "--enable-videotoolbox"
164- args << "--enable-audiotoolbox"
165- end
166-
134+ args += %w[ --enable-videotoolbox --enable-audiotoolbox ] if OS . mac?
167135 args << "--enable-neon" if Hardware ::CPU . arm?
168136
169- args << "--disable-htmlpages"
170- args << "--enable-libaom" if build . with? "aom"
171- args << "--enable-chromaprint" if build . with? "chromaprint"
172- args << "--enable-libharfbuzz" if build . with? "harfbuzz"
137+ if build . with? "aom"
138+ args << "--enable-libaom"
139+ depends_on "xz" if OS . mac?
140+ end
141+
142+ args << "--enable-libaribb24" if build . with? "aribb24"
173143 args << "--enable-libdav1d" if build . with? "dav1d"
174- args << "--enable-libfdk-aac" if build . with? "fdk-aac"
175- args << "--enable-libfontconfig" if build . with? "fontconfig"
176- args << "--enable-libfreetype" if build . with? "freetype"
177144 args << "--enable-frei0r" if build . with? "frei0r"
145+ args << "--enable-libharfbuzz" if build . with? "harfbuzz"
178146 args << "--enable-libgme" if build . with? "game-music-emu"
179- args << "--enable-libass" if build . with? "libass"
180147 args << "--enable-libbluray" if build . with? "libbluray"
181- args << "--enable-libbs2b" if build . with? "libbs2b"
182- args << "--enable-libcaca" if build . with? "libcaca"
183- args << "--enable-libgsm" if build . with? "libgsm"
184- args << "--enable-libmodplug" if build . with? "libmodplug"
185- args << "--enable-librsvg" if build . with? "librsvg"
148+ args << "--enable-libopenh264" if build . with? "openh264"
186149 args << "--enable-libsoxr" if build . with? "libsoxr"
187150 args << "--enable-libssh" if build . with? "libssh"
188151 args << "--enable-libvidstab" if build . with? "libvidstab"
189- args << "--enable-libxml2 " if build . with? "libxml2 "
190- args << "--enable-libopenh264 " if build . with? "openh264 "
191- args << "--enable-openssl " if build . with? "openssl "
152+ args << "--enable-libvmaf " if build . with? "libvmaf "
153+ args << "--enable-libvorbis " if build . with? "libvorbis "
154+ args << "--enable-libvpx " if build . with? "libvpx "
192155 args << "--enable-librav1e" if build . with? "rav1e"
156+ args << "--enable-libsnappy" if build . with? "snappy"
193157 args << "--enable-libspeex" if build . with? "speex"
194158 args << "--enable-libsrt" if build . with? "srt"
195- args << "--enable-librist" if build . with? "librist"
196159 args << "--enable-libsvtav1" if build . with? "svt-av1"
197160 args << "--enable-libtwolame" if build . with? "two-lame"
198- args << "--enable-libwavpack" if build . with? "wavpack"
199- args << "--enable-libwebp" if build . with? "webp"
200161 args << "--enable-libxvid" if build . with? "xvid"
201162 args << "--enable-libzmq" if build . with? "zeromq"
202163 args << "--enable-libzimg" if build . with? "zimg"
203164
204- # These librares are GPL-incompatible, and require ffmpeg be built with
205- # the "--enable-nonfree" flag, which produces unredistributable libraries
206- args << "--enable-nonfree" if build . with? ( "decklink" ) || build . with? ( "fdk-aac" ) || build . with? ( "openssl" )
165+ if build . with? "libass"
166+ args << "--enable-libass"
167+ depends_on "libx11" if OS . mac?
168+ depends_on "libxcb" if OS . mac?
169+ end
207170
208- if build . with? "decklink"
209- args << "--enable-decklink"
210- args << "--extra-cflags=-I#{ HOMEBREW_PREFIX } /include"
211- args << "--extra-ldflags=-L#{ HOMEBREW_PREFIX } /include"
171+ if build . with? "fdk-aac"
172+ args << "--enable-nonfree"
173+ args << "--enable-libfdk-aac"
212174 end
213175
214- args << "--enable-version3" if build . with? ( "opencore-amr" ) || build . with? ( "libvmaf" )
176+ if build . with? "jpeg-xl"
177+ args << "--enable-libjxl"
178+ depends_on "xz" if OS . mac?
179+ end
215180
216181 if build . with? "opencore-amr"
217182 args << "--enable-libopencore-amrnb"
@@ -222,6 +187,8 @@ def install
222187 args << "--enable-libopenjpeg"
223188 args << "--disable-decoder=jpeg2000"
224189 args << ( "--extra-cflags=" + `pkg-config --cflags libopenjp2` . chomp )
190+
191+ depends_on "xz" if OS . mac?
225192 end
226193
227194 if build . with? "rubberband"
@@ -232,8 +199,20 @@ def install
232199 if build . with? "tesseract"
233200 args << "--enable-libtesseract"
234201 depends_on "libarchive" if OS . mac?
202+ depends_on "libx11" if OS . mac?
203+ depends_on "libxcb" if OS . mac?
204+ depends_on "xz" if OS . mac?
205+ end
206+
207+ if build . with? "theora"
208+ args << "--enable-libtheora"
209+ depends_on "libogg"
210+ end
211+
212+ if build . with? "webp"
213+ args << "--enable-libwebp"
214+ depends_on "xz" if OS . mac?
235215 end
236- args << "--enable-libvmaf" if build . with? "libvmaf"
237216
238217 system "./configure" , *args
239218 system "make" , "install"
@@ -245,9 +224,13 @@ def install
245224 end
246225
247226 test do
248- # Create an example mp4 file
249227 mp4out = testpath /"video.mp4"
250- system bin /"ffmpeg" , "-filter_complex" , "testsrc=rate=1:duration=1" , mp4out
251- assert_path_exists mp4out
228+ system bin /"ffmpeg" , "-filter_complex" , "testsrc=rate=1:duration=5" , mp4out
229+ assert_match ( /Duration: 00:00:05\. 00,.*Video: h264/m , shell_output ( "#{ bin } /ffprobe -hide_banner #{ mp4out } 2>&1" ) )
230+
231+ # Re-encode it in HEVC/Matroska
232+ mkvout = testpath /"video.mkv"
233+ system bin /"ffmpeg" , "-i" , mp4out , "-c:v" , "hevc" , mkvout
234+ assert_match ( /Duration: 00:00:05\. 00,.*Video: hevc/m , shell_output ( "#{ bin } /ffprobe -hide_banner #{ mkvout } 2>&1" ) )
252235 end
253236end
0 commit comments