class FfmpegAT28 < Formula desc "Play, record, convert, and stream audio and video" homepage "https://ffmpeg.org/" url "https://ffmpeg.org/releases/ffmpeg-2.8.20.tar.xz" sha256 "8566e326c3f4e47c67a176c9d14c1efe0852d025be378183ad7f5ceb2a7676c7" # None of these parts are used by default, you have to explicitly pass `--enable-gpl` # to configure to activate them. In this case, FFmpeg's license changes to GPL v2+. license "GPL-2.0-or-later" revision 1 livecheck do url "https://ffmpeg.org/download.html" regex(/href=.*?ffmpeg[._-]v?(2\.8(?:\.\d+)*)\.t/i) end bottle do sha256 arm64_monterey: "6502ce2cc2cc1177957eeace83265254b063bac9bfd4ba92e048324456514592" sha256 arm64_big_sur: "aec6ec031f02fdcc7551142225d35e8b01f6852b89b07e13c3965ec869ddac7c" sha256 monterey: "8a5fe7f96f3a68ad134d1b0f07a2336e3a134ef1f61dd86d34266707b1e4e976" sha256 big_sur: "eb22288ea2eb879dbded818fbf9850da0f8c9b0b5338e390b52f7975e61acc65" sha256 catalina: "70c26b5cc479f01d315b5a4c1c1856bedf407e61b66898e2baff3fbfe7c043a4" sha256 x86_64_linux: "fb79180e038db7152fcbe6f8015e12782dfa1cbb17bc1c776e35ff02b5451394" end keg_only :versioned_formula depends_on "pkg-config" => :build depends_on "texi2html" => :build depends_on "yasm" => :build depends_on "fontconfig" depends_on "freetype" depends_on "frei0r" depends_on "lame" depends_on "libass" depends_on "libvo-aacenc" depends_on "libvorbis" depends_on "libvpx" depends_on "opencore-amr" depends_on "opus" depends_on "rtmpdump" depends_on "sdl" depends_on "snappy" depends_on "speex" depends_on "theora" depends_on "x264" depends_on "x265" depends_on "xvid" depends_on "xz" # try to change to uses_from_macos after python is not a dependency def install args = %W[ --prefix=#{prefix} --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=#{ENV.cc} --host-cflags=#{ENV.cflags} --host-ldflags=#{ENV.ldflags} --enable-ffplay --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --disable-indev=jack --disable-libxcb --disable-xlib ] args << "--enable-opencl" if OS.mac? # A bug in a dispatch header on 10.10, included via CoreFoundation, # prevents GCC from building VDA support. GCC has no problems on # 10.9 and earlier. # See: https://github.com/Homebrew/homebrew/issues/33741 args << if ENV.compiler == :clang "--enable-vda" else "--disable-vda" end system "./configure", *args inreplace "config.mak" do |s| shflags = s.get_make_var "SHFLAGS" s.change_make_var! "SHFLAGS", shflags if shflags.gsub!(" -Wl,-read_only_relocs,suppress", "") end system "make", "install" # Build and install additional FFmpeg tools system "make", "alltools" bin.install Dir["tools/*"].select { |f| File.executable? f } end test do # Create an example mp4 file mp4out = testpath/"video.mp4" system bin/"ffmpeg", "-y", "-filter_complex", "testsrc=rate=1:duration=1", mp4out assert_predicate mp4out, :exist? end end