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-libass" , "Enable ASS/SSA subtitle format"
21+ option "with-libbluray" , "Enable libbluray supoort"
2822 option "with-libsoxr" , "Enable the soxr resample library"
2923 option "with-libssh" , "Enable SFTP protocol via libssh"
30- option "with-tesseract" , "Enable the tesseract OCR engine"
3124 option "with-libvidstab" , "Enable vid.stab support for video stabilization"
25+ option "with-libvmaf" , "Enable libvmaf scoring library"
26+ option "with-libvorbis" , "Enable vorbis codec"
27+ option "with-libvpx" , "Enable vpx video codec"
3228 option "with-opencore-amr" , "Enable Opencore AMR NR/WB audio format"
33- option "with-openh264" , "Enable OpenH264 library"
3429 option "with-openjpeg" , "Enable JPEG 2000 image format"
35- option "with-openssl" , "Enable SSL support"
3630 option "with-rav1e" , "Enable Rav1e AV1 encoder"
3731 option "with-rubberband" , "Enable rubberband library"
32+ option "with-snappy" , "Enable snappy codec"
33+ option "with-speex" , "Enable speex codec"
34+ option "with-srt" , "Enable SRT library"
3835 option "with-svt-av1" , "Enable SVT-AV1 encoder"
36+ option "with-tesseract" , "Enable the tesseract OCR engine"
37+ option "with-theora" , "Enable theora codec"
3938 option "with-webp" , "Enable using libwebp to encode WEBP images"
39+ option "with-xvid" , "Enable Xvid codec"
4040 option "with-zeromq" , "Enable using libzeromq to receive commands sent through a libzeromq client"
41- 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"
46-
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"
5141
5242 depends_on "pkg-config" => :build
43+
5344 depends_on "lame"
54- depends_on "libvorbis"
55- depends_on "libvpx"
5645 depends_on "opus"
5746 depends_on "sdl2"
58- depends_on "snappy"
59- depends_on "theora"
6047 depends_on "x264"
6148 depends_on "x265"
62- depends_on "xz"
49+ depends_on "zeromq"
50+
6351 depends_on "aom" => :optional
52+ depends_on "aribb24" => :optional
6453 depends_on "dav1d" => :optional
65- depends_on "fdk-aac" => :optional
66- depends_on "fontconfig" => :optional
67- depends_on "freetype" => :optional
6854 depends_on "frei0r" => :optional
69- depends_on "game-music-emu" => :optional
7055 depends_on "harfbuzz" => :optional
7156 depends_on "libass" => :optional
7257 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
7958 depends_on "libsoxr" => :optional
8059 depends_on "libssh" => :optional
8160 depends_on "libvidstab" => :optional
8261 depends_on "libvmaf" => :optional
83- depends_on "libxml2" => :optional
62+ depends_on "libvorbis" => :optional
63+ depends_on "libvpx" => :optional
8464 depends_on "opencore-amr" => :optional
85- depends_on "openh264" => :optional
8665 depends_on "openjpeg" => :optional
87- depends_on "openssl@1.1" => :optional
8866 depends_on "rav1e" => :optional
8967 depends_on "rubberband" => :optional
68+ depends_on "snappy" => :optional
9069 depends_on "speex" => :optional
9170 depends_on "srt" => :optional
9271 depends_on "svt-av1" => :optional
9372 depends_on "tesseract" => :optional
94- depends_on "two-lame" => :optional
95- depends_on "wavpack" => :optional
73+ depends_on "theora" => :optional
9674 depends_on "webp" => :optional
9775 depends_on "xvid" => :optional
98- depends_on "zeromq" => :optional
99- depends_on "zimg" => :optional
10076
10177 uses_from_macos "bzip2"
10278 uses_from_macos "libxml2"
10379 uses_from_macos "zlib"
10480
105- on_macos do
106- depends_on "libogg"
107- end
108-
10981 on_linux do
11082 depends_on "alsa-lib"
111- depends_on "gcc"
112- depends_on "libx11"
11383 depends_on "libxcb"
114- depends_on "libxext"
115- depends_on "libxv" # because rubberband is compiled with gcc
84+ depends_on "xz"
11685 end
11786
11887 on_intel do
@@ -122,8 +91,6 @@ class FfmpegCustom < Formula
12291 conflicts_with "ffmpeg" ,
12392 because : "ffmpeg-custom and ffmpeg both install ffmpeg binary"
12493
125- fails_with gcc : "5"
126-
12794 # Fix for QtWebEngine, do not remove
12895 # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270209
12996 patch do
@@ -132,7 +99,7 @@ class FfmpegCustom < Formula
13299 end
133100
134101 def install
135- ENV . append "LDFLAGS" , "-Wl,-ld_classic" if DevelopmentTools . clang_build_version >= 1500
102+ ENV . append "LDFLAGS" , "-Wl,-ld_classic" if DevelopmentTools . ld64_version . between? ( "1015.7" , "1022.1" )
136103
137104 args = %W[
138105 --prefix=#{ prefix }
@@ -144,75 +111,45 @@ def install
144111 --host-ldflags=#{ ENV . ldflags }
145112 --enable-ffplay
146113 --enable-gpl
147- --enable-demuxer=dash
148114 --enable-libmp3lame
149115 --enable-libopus
150- --enable-libsnappy
151- --enable-libtheora
152- --enable-libvorbis
153- --enable-libvpx
154116 --enable-libx264
155117 --enable-libx265
156- --enable-lzma
157- --disable-libjack
158- --disable-indev=jack
118+ --enable-libzmq
159119 ]
160120
161- if OS . mac?
162- args << "--enable-opencl"
163- args << "--enable-videotoolbox"
164- args << "--enable-audiotoolbox"
165- end
166-
121+ args += %w[ --enable-videotoolbox --enable-audiotoolbox ] if OS . mac?
167122 args << "--enable-neon" if Hardware ::CPU . arm?
168123
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"
124+ if build . with? "aom"
125+ args << "--enable-libaom"
126+ depends_on "xz" if OS . mac?
127+ end
128+
129+ args << "--enable-libaribb24" if build . with? "aribb24"
173130 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"
177131 args << "--enable-frei0r" if build . with? "frei0r"
178- args << "--enable-libgme" if build . with? "game-music-emu"
179- args << "--enable-libass" if build . with? "libass"
132+ args << "--enable-libharfbuzz" if build . with? "harfbuzz"
180133 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"
186134 args << "--enable-libsoxr" if build . with? "libsoxr"
187135 args << "--enable-libssh" if build . with? "libssh"
188136 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 "
137+ args << "--enable-libvmaf " if build . with? "libvmaf "
138+ args << "--enable-libvorbis " if build . with? "libvorbis "
139+ args << "--enable-libvpx " if build . with? "libvpx "
192140 args << "--enable-librav1e" if build . with? "rav1e"
141+ args << "--enable-libsnappy" if build . with? "snappy"
193142 args << "--enable-libspeex" if build . with? "speex"
194143 args << "--enable-libsrt" if build . with? "srt"
195- args << "--enable-librist" if build . with? "librist"
196144 args << "--enable-libsvtav1" if build . with? "svt-av1"
197- args << "--enable-libtwolame" if build . with? "two-lame"
198- args << "--enable-libwavpack" if build . with? "wavpack"
199- args << "--enable-libwebp" if build . with? "webp"
200145 args << "--enable-libxvid" if build . with? "xvid"
201- args << "--enable-libzmq" if build . with? "zeromq"
202- args << "--enable-libzimg" if build . with? "zimg"
203146
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" )
207-
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"
147+ if build . with? "libass"
148+ args << "--enable-libass"
149+ depends_on "libx11" if OS . mac?
150+ depends_on "libxcb" if OS . mac?
212151 end
213152
214- args << "--enable-version3" if build . with? ( "opencore-amr" ) || build . with? ( "libvmaf" )
215-
216153 if build . with? "opencore-amr"
217154 args << "--enable-libopencore-amrnb"
218155 args << "--enable-libopencore-amrwb"
@@ -222,6 +159,8 @@ def install
222159 args << "--enable-libopenjpeg"
223160 args << "--disable-decoder=jpeg2000"
224161 args << ( "--extra-cflags=" + `pkg-config --cflags libopenjp2` . chomp )
162+
163+ depends_on "xz" if OS . mac?
225164 end
226165
227166 if build . with? "rubberband"
@@ -232,8 +171,20 @@ def install
232171 if build . with? "tesseract"
233172 args << "--enable-libtesseract"
234173 depends_on "libarchive" if OS . mac?
174+ depends_on "libx11" if OS . mac?
175+ depends_on "libxcb" if OS . mac?
176+ depends_on "xz" if OS . mac?
177+ end
178+
179+ if build . with? "theora"
180+ args << "--enable-libtheora"
181+ depends_on "libogg"
182+ end
183+
184+ if build . with? "webp"
185+ args << "--enable-libwebp"
186+ depends_on "xz" if OS . mac?
235187 end
236- args << "--enable-libvmaf" if build . with? "libvmaf"
237188
238189 system "./configure" , *args
239190 system "make" , "install"
@@ -245,9 +196,13 @@ def install
245196 end
246197
247198 test do
248- # Create an example mp4 file
249199 mp4out = testpath /"video.mp4"
250- system bin /"ffmpeg" , "-filter_complex" , "testsrc=rate=1:duration=1" , mp4out
251- assert_path_exists mp4out
200+ system bin /"ffmpeg" , "-filter_complex" , "testsrc=rate=1:duration=5" , mp4out
201+ assert_match ( /Duration: 00:00:05\. 00,.*Video: h264/m , shell_output ( "#{ bin } /ffprobe -hide_banner #{ mp4out } 2>&1" ) )
202+
203+ # Re-encode it in HEVC/Matroska
204+ mkvout = testpath /"video.mkv"
205+ system bin /"ffmpeg" , "-i" , mp4out , "-c:v" , "hevc" , mkvout
206+ assert_match ( /Duration: 00:00:05\. 00,.*Video: hevc/m , shell_output ( "#{ bin } /ffprobe -hide_banner #{ mkvout } 2>&1" ) )
252207 end
253208end
0 commit comments