homebrew-core/Formula/ffmpeg.rb

148 lines
4.0 KiB
Ruby

class Ffmpeg < Formula
desc "Play, record, convert, and stream audio and video"
homepage "https://ffmpeg.org/"
url "https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz"
sha256 "619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc"
# 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
head "https://github.com/FFmpeg/FFmpeg.git", branch: "master"
livecheck do
url "https://ffmpeg.org/download.html"
regex(/href=.*?ffmpeg[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_ventura: "f466d4f3dcfef75c2c48794cce65591d650c7527f6a62f4459b59b5267802c1f"
sha256 arm64_monterey: "3afae87e1e1811edd4c10d394aebcfcd1e0cc045cd784d384ac5a8dbcbe133db"
sha256 arm64_big_sur: "6b4dff8fde7b2a19d82c870cabd3fde7c1fe04d9f703ae62daa12f680664b7fc"
sha256 ventura: "71d21f0b5d6dca421640010c37b068a0a6a9868a569fc5b4df9af257bbd5fd87"
sha256 monterey: "0c3cd448280893bc81059b4044bb7363b3acaa62d3a70982a0d887ca19b783f8"
sha256 big_sur: "c9d1d2f372ab573ff64d62c9239d4f04bf8f2c8ad8045ef88d38ce3784176fc3"
sha256 x86_64_linux: "d63b9a6fae303abde2bafb8be30a8a727afae0655d96c562ec6986f6fecbc9ff"
end
depends_on "pkg-config" => :build
depends_on "aom"
depends_on "dav1d"
depends_on "fontconfig"
depends_on "freetype"
depends_on "frei0r"
depends_on "gnutls"
depends_on "lame"
depends_on "libass"
depends_on "libbluray"
depends_on "librist"
depends_on "libsoxr"
depends_on "libvidstab"
depends_on "libvmaf"
depends_on "libvorbis"
depends_on "libvpx"
depends_on "opencore-amr"
depends_on "openjpeg"
depends_on "opus"
depends_on "rav1e"
depends_on "rubberband"
depends_on "sdl2"
depends_on "snappy"
depends_on "speex"
depends_on "srt"
depends_on "tesseract"
depends_on "theora"
depends_on "webp"
depends_on "x264"
depends_on "x265"
depends_on "xvid"
depends_on "xz"
depends_on "zeromq"
depends_on "zimg"
uses_from_macos "bzip2"
uses_from_macos "libxml2"
uses_from_macos "zlib"
on_linux do
depends_on "alsa-lib"
depends_on "libxv"
end
on_intel do
depends_on "nasm" => :build
end
fails_with gcc: "5"
def install
args = %W[
--prefix=#{prefix}
--enable-shared
--enable-pthreads
--enable-version3
--cc=#{ENV.cc}
--host-cflags=#{ENV.cflags}
--host-ldflags=#{ENV.ldflags}
--enable-ffplay
--enable-gnutls
--enable-gpl
--enable-libaom
--enable-libbluray
--enable-libdav1d
--enable-libmp3lame
--enable-libopus
--enable-librav1e
--enable-librist
--enable-librubberband
--enable-libsnappy
--enable-libsrt
--enable-libtesseract
--enable-libtheora
--enable-libvidstab
--enable-libvmaf
--enable-libvorbis
--enable-libvpx
--enable-libwebp
--enable-libx264
--enable-libx265
--enable-libxml2
--enable-libxvid
--enable-lzma
--enable-libfontconfig
--enable-libfreetype
--enable-frei0r
--enable-libass
--enable-libopencore-amrnb
--enable-libopencore-amrwb
--enable-libopenjpeg
--enable-libspeex
--enable-libsoxr
--enable-libzmq
--enable-libzimg
--disable-libjack
--disable-indev=jack
]
# Needs corefoundation, coremedia, corevideo
args << "--enable-videotoolbox" if OS.mac?
args << "--enable-neon" if Hardware::CPU.arm?
system "./configure", *args
system "make", "install"
# Build and install additional FFmpeg tools
system "make", "alltools"
bin.install Dir["tools/*"].select { |f| File.executable? f }
# Fix for Non-executables that were installed to bin/
mv bin/"python", pkgshare/"python", force: true
end
test do
# Create an example mp4 file
mp4out = testpath/"video.mp4"
system bin/"ffmpeg", "-filter_complex", "testsrc=rate=1:duration=1", mp4out
assert_predicate mp4out, :exist?
end
end