Skip to content

Commit 04da8ae

Browse files
committed
sync our formula with the upstream
1 parent f6350ad commit 04da8ae

1 file changed

Lines changed: 106 additions & 21 deletions

File tree

Formula/ffmpeg.rb

Lines changed: 106 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,142 @@
11
class Ffmpeg < Formula
22
desc "Play, record, convert, and stream audio and video"
33
homepage "https://ffmpeg.org/"
4-
url "https://ffmpeg.org/releases/ffmpeg-8.1.tar.xz"
5-
version "8.1-with-options" # to distinguish from homebrew-core's ffmpeg
6-
sha256 "b072aed6871998cce9b36e7774033105ca29e33632be5b6347f3206898e0756a"
4+
url "https://ffmpeg.org/releases/ffmpeg-9.0.1.tar.xz"
5+
sha256 "cf38e0e28c7e5605942c4a77755349b0145804a397af37eb1fb4c77cb237f635"
76
license "GPL-2.0-or-later"
87
head "https://github.com/FFmpeg/FFmpeg.git", branch: "master"
98

9+
option "with-alt-name", "Use command names ff*-alt rather than ff*"
1010
option "with-chromaprint", "Enable the Chromaprint audio fingerprinting library"
1111
option "with-decklink", "Enable DeckLink support"
12+
option "with-dvd", "Enable DVD-Video demuxer, powered by libdvdnav and libdvdread"
1213
option "with-fdk-aac", "Enable the Fraunhofer FDK AAC library"
14+
option "with-libflite", "Enable text to speech synthesis support via Flite"
1315
option "with-game-music-emu", "Enable Game Music Emu (GME) support"
16+
option "with-ggml", "Enable tensor library for machine learning"
1417
option "with-jack", "Enable Jack support"
18+
option "with-jpeg-xl", "Enable JPEG XL image format"
1519
option "with-libaribb24", "Enable decoding ARIB/ISDB captions"
20+
option "with-libaribcaption", "Enable ARIB STD-B24 based broadcast captions"
1621
option "with-libmodplug", "Enable module/tracker files as inputs via libmodplug"
1722
option "with-libopenmpt", "Enable module/tracker files as inputs via libopenmpt"
23+
option "with-libplacebo", "Enable GPU-accelerated image/video processing primitives"
1824
option "with-librist", "Enable Reliable Internet Stream Transport (RIST) support"
1925
option "with-librsvg", "Enable SVG files as inputs via librsvg"
2026
option "with-libsoxr", "Enable the soxr resample library"
2127
option "with-libssh", "Enable SFTP protocol via libssh"
28+
option "with-tensorflow", "Enable TensorFlow as a module backend for DNN-based filters"
2229
option "with-tesseract", "Enable the tesseract OCR engine"
2330
option "with-libvidstab", "Enable vid.stab support for video stabilization"
31+
option "with-openal-soft", "Enable OpenAL (Open Audio Library) for macOS targets"
32+
option "with-openapv", "Enable OpenAPV (Open Advanced Professional Video Codec)"
2433
option "with-opencore-amr", "Enable Opencore AMR NR/WB audio format"
2534
option "with-openh264", "Enable OpenH264 library"
2635
option "with-openjpeg", "Enable JPEG 2000 image format"
2736
option "with-openssl", "Enable SSL support"
37+
option "with-openvino", "Enable OpenVINO as a module backend for DNN-based filters"
2838
option "with-rav1e", "Enable AV1 encoding via librav1e"
29-
option "with-svt-av1", "Enable Scalable Video Technology for AV1"
3039
option "with-rtmpdump", "Enable RTMP dumping support"
3140
option "with-rubberband", "Enable rubberband library"
41+
option "with-two-lame", "Enable TwoLAME, an optimized MPEG Audio Layer 2 (MP2) encoder"
3242
option "with-webp", "Enable using libwebp to encode WEBP images"
43+
option "with-whisper-cpp", "Enable OpenAI's Whisper speech recognition model"
44+
option "with-xvid", "Enable Xvid"
3345
option "with-zeromq", "Enable using libzeromq to receive cmds sent through a libzeromq client"
3446
option "with-zimg", "Enable z.lib zimg library"
3547
option "with-srt", "Enable SRT library"
3648
option "with-libvmaf", "Enable libvmaf scoring library"
3749
option "with-libxml2", "Enable libxml2 library"
3850
option "with-libzvbi", "Enable decoding of DVB teletext pages and DVB teletext subtitles"
3951

40-
depends_on "pkg-config" => :build
52+
depends_on "pkgconf" => :build
4153

4254
depends_on "aom"
4355
depends_on "dav1d"
4456
depends_on "fontconfig"
4557
depends_on "freetype"
46-
depends_on "frei0r"
58+
depends_on "frei0r" => :no_linkage
59+
depends_on "harfbuzz"
4760
depends_on "lame"
4861
depends_on "libass"
4962
depends_on "libvorbis"
5063
depends_on "libvpx"
5164
depends_on "opus"
5265
depends_on "sdl2"
5366
depends_on "snappy"
67+
depends_on "svt-av1"
5468
depends_on "theora"
5569
depends_on "x264"
5670
depends_on "x265"
5771
depends_on "xz"
5872

5973
depends_on "aribb24" => :optional
74+
depends_on "chromaprint" => :optional
6075
depends_on "fdk-aac" => :optional
6176
depends_on "game-music-emu" => :optional
77+
depends_on "ggml" => :optional
6278
depends_on "jack" => :optional
79+
depends_on "jpeg-xl" => :optional
80+
depends_on "libaribcaption" => :optional
6381
depends_on "libbluray" => :optional
6482
depends_on "libbs2b" => :optional
6583
depends_on "libcaca" => :optional
6684
depends_on "libgsm" => :optional
6785
depends_on "libmodplug" => :optional
6886
depends_on "libopenmpt" => :optional
87+
depends_on "libplacebo" => :optional
6988
depends_on "librist" => :optional
7089
depends_on "librsvg" => :optional
7190
depends_on "libsoxr" => :optional
7291
depends_on "libssh" => :optional
92+
depends_on "libtensorflow" => :optional
7393
depends_on "libvidstab" => :optional
7494
depends_on "libvmaf" => :optional
75-
depends_on "libxml2" => :optional
95+
depends_on "openal-soft" => :optional
96+
depends_on "openapv" => :optional
7697
depends_on "opencore-amr" => :optional
7798
depends_on "openh264" => :optional
7899
depends_on "openjpeg" => :optional
79100
depends_on "openssl@3" => :optional
101+
depends_on "openvino" => :optional
80102
depends_on "rav1e" => :optional
81103
depends_on "rtmpdump" => :optional
82104
depends_on "rubberband" => :optional
83105
depends_on "speex" => :optional
84106
depends_on "srt" => :optional
85-
depends_on "svt-av1" => :optional
86107
depends_on "tesseract" => :optional
87108
depends_on "two-lame" => :optional
88109
depends_on "webp" => :optional
110+
depends_on "whisper-cpp" => :optional
89111
depends_on "xvid" => :optional
90112
depends_on "zeromq" => :optional
91113
depends_on "zimg" => :optional
92114

115+
# `--with-dvd` needs the DVD libraries — plus libdvdcss, a dependency of
116+
# libdvdread — installed and discoverable via pkg-config at build time.
117+
if build.with? "dvd"
118+
depends_on "libdvdcss"
119+
depends_on "libdvdnav"
120+
depends_on "libdvdread"
121+
end
122+
93123
uses_from_macos "bzip2"
94124
uses_from_macos "zlib"
125+
uses_from_macos "libxml2" => :optional
126+
127+
on_macos do
128+
depends_on "libarchive"
129+
depends_on "libogg"
130+
depends_on "libsamplerate"
131+
end
95132

96133
on_linux do
97134
depends_on "alsa-lib"
135+
depends_on "libdrm"
136+
depends_on "libx11"
137+
depends_on "libxcb"
138+
depends_on "libxext"
98139
depends_on "libxv"
99-
depends_on "gcc" => :optional
100140
end
101141

102142
on_intel do
@@ -115,9 +155,11 @@ def install
115155
--enable-gpl
116156
--enable-libaom
117157
--enable-libdav1d
158+
--enable-libharfbuzz
118159
--enable-libmp3lame
119160
--enable-libopus
120161
--enable-libsnappy
162+
--enable-libsvtav1
121163
--enable-libtheora
122164
--enable-libvorbis
123165
--enable-libvpx
@@ -130,28 +172,33 @@ def install
130172
--enable-demuxer=dash
131173
]
132174

175+
args << "--enable-neon" if Hardware::CPU.arm?
176+
133177
if OS.mac?
178+
args << "--enable-openal" if build.with? "openal-soft"
134179
args << "--enable-opencl"
135180
args << "--enable-audiotoolbox"
136181
args << "--enable-videotoolbox"
137-
args << "--enable-neon" if Hardware::CPU.arm?
138182
end
139183

140184
args << "--disable-htmlpages" # The same info is accessible through the man pages.
141185
args << "--enable-chromaprint" if build.with? "chromaprint"
186+
args << "--enable-libaribcaption" if build.with? "libaribcaption"
142187
args << "--enable-libaribb24" if build.with? "libaribb24"
143188
args << "--enable-libbluray" if build.with? "libbluray"
144189
args << "--enable-libbs2b" if build.with? "libbs2b"
145190
args << "--enable-libcaca" if build.with? "libcaca"
146191
args << "--enable-libfdk-aac" if build.with? "fdk-aac"
192+
args << "--enable-libflite" if build.with? "libflite"
147193
args << "--enable-libgme" if build.with? "game-music-emu"
148194
args << "--enable-libgsm" if build.with? "libgsm"
195+
args << "--enable-libjxl" if build.with? "jpeg-xl"
149196
args << "--enable-libmodplug" if build.with? "libmodplug"
150197
args << "--enable-libopenh264" if build.with? "openh264"
151198
args << "--enable-libopenjpeg" if build.with? "openjpeg"
152199
args << "--enable-libopenmpt" if build.with? "libopenmpt"
200+
args << "--enable-libplacebo" if build.with? "libplacebo"
153201
args << "--enable-librav1e" if build.with? "rav1e"
154-
args << "--enable-libsvtav1" if build.with? "svt-av1"
155202
args << "--enable-librist" if build.with? "librist"
156203
args << "--enable-librsvg" if build.with? "librsvg"
157204
args << "--enable-librtmp" if build.with? "rtmpdump"
@@ -160,6 +207,7 @@ def install
160207
args << "--enable-libspeex" if build.with? "speex"
161208
args << "--enable-libsrt" if build.with? "srt"
162209
args << "--enable-libssh" if build.with? "libssh"
210+
args << "--enable-libtensorflow" if build.with? "tensorflow"
163211
args << "--enable-libtesseract" if build.with? "tesseract"
164212
args << "--enable-libtwolame" if build.with? "two-lame"
165213
args << "--enable-libvidstab" if build.with? "libvidstab"
@@ -168,9 +216,10 @@ def install
168216
args << "--enable-libxml2" if build.with? "libxml2"
169217
args << "--enable-libxvid" if build.with? "xvid"
170218
args << "--enable-libzimg" if build.with? "zimg"
171-
args << "--enable-libzvbi" if build.with? "libzvbi"
172219
args << "--enable-libzmq" if build.with? "zeromq"
173220
args << "--enable-openssl" if build.with? "openssl@3"
221+
args << "--enable-libopenvino" if build.with? "openvino"
222+
args << "--enable-liboapv" if build.with? "openapv"
174223

175224
# These librares are GPL-incompatible, and require ffmpeg be built with
176225
# the "--enable-nonfree" flag, which produces unredistributable libraries
@@ -183,14 +232,24 @@ def install
183232
mv "VERSION", "VERSION.txt"
184233
end
185234

235+
if build.with? "dvd"
236+
ENV.prepend_path "PKG_CONFIG_PATH", formula_opt_lib("libdvdnav")/"pkgconfig"
237+
ENV.prepend_path "PKG_CONFIG_PATH", formula_opt_lib("libdvdread")/"pkgconfig"
238+
ENV.prepend_path "PKG_CONFIG_PATH", formula_opt_lib("libdvdcss")/"pkgconfig"
239+
args << "--enable-libdvdnav"
240+
args << "--enable-libdvdread"
241+
end
242+
186243
if build.with? "jack"
187-
ENV.prepend_path "PKG_CONFIG_PATH", Formula["jack"].opt_lib/"pkgconfig"
244+
ENV.prepend_path "PKG_CONFIG_PATH", formula_opt_lib("jack")/"pkgconfig"
188245
args << "--enable-libjack"
189246
args << "--enable-indev=jack"
190247
end
191248

249+
args << "--enable-whisper" if build.with? "whisper-cpp"
250+
192251
if build.with? "libzvbi"
193-
ENV.prepend_path "PKG_CONFIG_PATH", Formula["zvbi"].opt_lib/"pkgconfig"
252+
ENV.prepend_path "PKG_CONFIG_PATH", formula_opt_lib("zvbi")/"pkgconfig"
194253
args << "--enable-libzvbi"
195254
end
196255

@@ -202,12 +261,19 @@ def install
202261
end
203262

204263
system "./configure", *args
205-
system "make", "install"
264+
if build.with? "alt-name"
265+
system "make"
266+
bin.install "ffmpeg" => "ffmpeg-alt"
267+
bin.install "ffprobe" => "ffprobe-alt"
268+
bin.install "ffplay" => "ffplay-alt"
269+
else
270+
system "make", "install"
271+
end
206272

207273
# Build and install additional FFmpeg tools
208274
system "make", "alltools"
209-
bin.install Dir["tools/*"].select { |f| File.executable? f }
210-
mv bin/"python", pkgshare/"python", force: true
275+
bin.install (buildpath/"tools").children.select { |f| f.file? && f.executable? }
276+
pkgshare.install buildpath/"tools/python"
211277

212278
if build.with? "tesseract"
213279
opoo <<~EOS
@@ -218,9 +284,28 @@ def install
218284
end
219285

220286
test do
221-
# Create an example mp4 file
287+
# Create a 5 second test MP4
222288
mp4out = testpath/"video.mp4"
223-
system bin/"ffmpeg", "-filter_complex", "testsrc=rate=1:duration=1", mp4out
224-
assert_predicate mp4out, :exist?
289+
if build.with? "alt-name"
290+
system bin/"ffmpeg-alt", "-filter_complex", "testsrc=rate=1:duration=5", mp4out
291+
assert_match(/Duration: 00:00:05\.00,.*Video: h264/m,
292+
shell_output("#{bin}/ffprobe-alt -hide_banner #{mp4out} 2>&1"))
293+
else
294+
system bin/"ffmpeg", "-filter_complex", "testsrc=rate=1:duration=5", mp4out
295+
assert_match(/Duration: 00:00:05\.00,.*Video: h264/m,
296+
shell_output("#{bin}/ffprobe -hide_banner #{mp4out} 2>&1"))
297+
end
298+
299+
# Re-encode it in HEVC/Matroska
300+
mkvout = testpath/"video.mkv"
301+
if build.with? "alt-name"
302+
system bin/"ffmpeg-alt", "-i", mp4out, "-c:v", "hevc", mkvout
303+
assert_match(/Duration: 00:00:05\.00,.*Video: hevc/m,
304+
shell_output("#{bin}/ffprobe-alt -hide_banner #{mkvout} 2>&1"))
305+
else
306+
system bin/"ffmpeg", "-i", mp4out, "-c:v", "hevc", mkvout
307+
assert_match(/Duration: 00:00:05\.00,.*Video: hevc/m,
308+
shell_output("#{bin}/ffprobe -hide_banner #{mkvout} 2>&1"))
309+
end
225310
end
226-
end
311+
end

0 commit comments

Comments
 (0)