├── .gitignore ├── decklink-api-10.4.tar.gz ├── Library └── Formula │ ├── decklink.rb │ └── ffmpeg.rb └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /decklink-api-10.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dche/ffmpeg-decklink/HEAD/decklink-api-10.4.tar.gz -------------------------------------------------------------------------------- /Library/Formula/decklink.rb: -------------------------------------------------------------------------------- 1 | class Decklink < Formula 2 | homepage "https://github.com/dche/ffmpeg-decklink" 3 | url "https://github.com/dche/ffmpeg-decklink/raw/master/decklink-api-10.4.tar.gz" 4 | sha256 "0549bb15777a8175e9e4d01c69156b35ff84718196f76586d3c5b88a42977071" 5 | 6 | def install 7 | include.install Dir["include/*"] 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # What is this? 3 | 4 | [Homebrew](http://brew.sh) formulas for building [FFmpeg](https://www.ffmpeg.org) with `--enable-decklink` option. 5 | 6 | # Usage 7 | 8 | ```bash 9 | brew install https://github.com/dche/ffmpeg-decklink/raw/master/Library/Formula/decklink.rb 10 | brew install https://github.com/dche/ffmpeg-decklink/raw/master/Library/Formula/ffmpeg.rb --with-decklink 11 | ``` 12 | -------------------------------------------------------------------------------- /Library/Formula/ffmpeg.rb: -------------------------------------------------------------------------------- 1 | class Ffmpeg < Formula 2 | desc "Play, record, convert, and stream audio and video" 3 | homepage "https://ffmpeg.org/" 4 | url "https://ffmpeg.org/releases/ffmpeg-2.8.3.tar.bz2" 5 | sha256 "1bcf993a71839bb4a37eaa0c51daf315932b6dad6089f672294545cc51a5caf6" 6 | 7 | head "https://github.com/FFmpeg/FFmpeg.git" 8 | 9 | option "without-x264", "Disable H.264 encoder" 10 | option "without-lame", "Disable MP3 encoder" 11 | option "without-libvo-aacenc", "Disable VisualOn AAC encoder" 12 | option "without-xvid", "Disable Xvid MPEG-4 video encoder" 13 | option "without-qtkit", "Disable deprecated QuickTime framework" 14 | 15 | option "with-rtmpdump", "Enable RTMP protocol" 16 | option "with-libass", "Enable ASS/SSA subtitle format" 17 | option "with-opencore-amr", "Enable Opencore AMR NR/WB audio format" 18 | option "with-openjpeg", "Enable JPEG 2000 image format" 19 | option "with-openssl", "Enable SSL support" 20 | option "with-libssh", "Enable SFTP protocol via libssh" 21 | option "with-schroedinger", "Enable Dirac video format" 22 | option "with-ffplay", "Enable FFplay media player" 23 | option "with-tools", "Enable additional FFmpeg tools" 24 | option "with-fdk-aac", "Enable the Fraunhofer FDK AAC library" 25 | option "with-libvidstab", "Enable vid.stab support for video stabilization" 26 | option "with-x265", "Enable x265 encoder" 27 | option "with-libsoxr", "Enable the soxr resample library" 28 | option "with-webp", "Enable using libwebp to encode WEBP images" 29 | option "with-zeromq", "Enable using libzeromq to receive commands sent through a libzeromq client" 30 | option "with-snappy", "Enable Snappy library" 31 | option "with-decklink", "Enable using Blackmagic Design's Decklink devices." 32 | 33 | depends_on "pkg-config" => :build 34 | 35 | # manpages won't be built without texi2html 36 | depends_on "texi2html" => :build 37 | depends_on "yasm" => :build 38 | 39 | depends_on "x264" => :recommended 40 | depends_on "lame" => :recommended 41 | depends_on "libvo-aacenc" => :recommended 42 | depends_on "xvid" => :recommended 43 | 44 | depends_on "faac" => :optional 45 | depends_on "fontconfig" => :optional 46 | depends_on "freetype" => :optional 47 | depends_on "theora" => :optional 48 | depends_on "libvorbis" => :optional 49 | depends_on "libvpx" => :optional 50 | depends_on "rtmpdump" => :optional 51 | depends_on "opencore-amr" => :optional 52 | depends_on "libass" => :optional 53 | depends_on "openjpeg" => :optional 54 | depends_on "sdl" if build.with? "ffplay" 55 | depends_on "snappy" => :optional 56 | depends_on "speex" => :optional 57 | depends_on "schroedinger" => :optional 58 | depends_on "fdk-aac" => :optional 59 | depends_on "opus" => :optional 60 | depends_on "frei0r" => :optional 61 | depends_on "libcaca" => :optional 62 | depends_on "libbluray" => :optional 63 | depends_on "libsoxr" => :optional 64 | depends_on "libquvi" => :optional 65 | depends_on "libvidstab" => :optional 66 | depends_on "x265" => :optional 67 | depends_on "openssl" => :optional 68 | depends_on "libssh" => :optional 69 | depends_on "webp" => :optional 70 | depends_on "zeromq" => :optional 71 | depends_on "libbs2b" => :optional 72 | depends_on "decklink" if build.with? "decklink" 73 | 74 | if build.with? "decklink" 75 | # patch `common.mk` for using `clang++` to compile `.cpp` files, 76 | # by removing `-std=c99` from `CXXFLAGS`. 77 | patch :DATA 78 | end 79 | 80 | def install 81 | args = ["--prefix=#{prefix}", 82 | "--enable-shared", 83 | "--enable-pthreads", 84 | "--enable-gpl", 85 | "--enable-version3", 86 | "--enable-hardcoded-tables", 87 | "--enable-avresample", 88 | "--cc=#{ENV.cc}", 89 | "--host-cflags=#{ENV.cflags}", 90 | "--host-ldflags=#{ENV.ldflags}", 91 | ] 92 | 93 | args << "--enable-opencl" if MacOS.version > :lion 94 | args << "--enable-libx264" if build.with? "x264" 95 | args << "--enable-libmp3lame" if build.with? "lame" 96 | args << "--enable-libvo-aacenc" if build.with? "libvo-aacenc" 97 | args << "--enable-libxvid" if build.with? "xvid" 98 | args << "--enable-libsnappy" if build.with? "snappy" 99 | 100 | args << "--enable-libfontconfig" if build.with? "fontconfig" 101 | args << "--enable-libfreetype" if build.with? "freetype" 102 | args << "--enable-libtheora" if build.with? "theora" 103 | args << "--enable-libvorbis" if build.with? "libvorbis" 104 | args << "--enable-libvpx" if build.with? "libvpx" 105 | args << "--enable-librtmp" if build.with? "rtmpdump" 106 | args << "--enable-libopencore-amrnb" << "--enable-libopencore-amrwb" if build.with? "opencore-amr" 107 | args << "--enable-libfaac" if build.with? "faac" 108 | args << "--enable-libass" if build.with? "libass" 109 | args << "--enable-ffplay" if build.with? "ffplay" 110 | args << "--enable-libssh" if build.with? "libssh" 111 | args << "--enable-libspeex" if build.with? "speex" 112 | args << "--enable-libschroedinger" if build.with? "schroedinger" 113 | args << "--enable-libfdk-aac" if build.with? "fdk-aac" 114 | args << "--enable-openssl" if build.with? "openssl" 115 | args << "--enable-libopus" if build.with? "opus" 116 | args << "--enable-frei0r" if build.with? "frei0r" 117 | args << "--enable-libcaca" if build.with? "libcaca" 118 | args << "--enable-libsoxr" if build.with? "libsoxr" 119 | args << "--enable-libquvi" if build.with? "libquvi" 120 | args << "--enable-libvidstab" if build.with? "libvidstab" 121 | args << "--enable-libx265" if build.with? "x265" 122 | args << "--enable-libwebp" if build.with? "webp" 123 | args << "--enable-libzmq" if build.with? "zeromq" 124 | args << "--enable-libbs2b" if build.with? "libbs2b" 125 | args << "--disable-indev=qtkit" if build.without? "qtkit" 126 | args << "--enable-decklink" if build.with? "decklink" 127 | 128 | if build.with? "openjpeg" 129 | args << "--enable-libopenjpeg" 130 | args << "--disable-decoder=jpeg2000" 131 | args << "--extra-cflags=" + `pkg-config --cflags libopenjpeg`.chomp 132 | end 133 | 134 | # These librares are GPL-incompatible, and require ffmpeg be built with 135 | # the "--enable-nonfree" flag, which produces unredistributable libraries 136 | if %w[faac fdk-aac openssl].any? { |f| build.with? f } 137 | args << "--enable-nonfree" 138 | end 139 | 140 | # A bug in a dispatch header on 10.10, included via CoreFoundation, 141 | # prevents GCC from building VDA support. GCC has no problems on 142 | # 10.9 and earlier. 143 | # See: https://github.com/Homebrew/homebrew/issues/33741 144 | if MacOS.version < :yosemite || ENV.compiler == :clang 145 | args << "--enable-vda" 146 | else 147 | args << "--disable-vda" 148 | end 149 | 150 | # For 32-bit compilation under gcc 4.2, see: 151 | # https://trac.macports.org/ticket/20938#comment:22 152 | ENV.append_to_cflags "-mdynamic-no-pic" if Hardware.is_32_bit? && Hardware::CPU.intel? && ENV.compiler == :clang 153 | 154 | system "./configure", *args 155 | 156 | if MacOS.prefer_64_bit? 157 | inreplace "config.mak" do |s| 158 | shflags = s.get_make_var "SHFLAGS" 159 | if shflags.gsub!(" -Wl,-read_only_relocs,suppress", "") 160 | s.change_make_var! "SHFLAGS", shflags 161 | end 162 | end 163 | end 164 | 165 | system "make", "install" 166 | 167 | if build.with? "tools" 168 | system "make", "alltools" 169 | bin.install Dir["tools/*"].select { |f| File.executable? f } 170 | end 171 | end 172 | 173 | def caveats 174 | if build.without? "faac" then <<-EOS.undent 175 | FFmpeg has been built without libfaac for licensing reasons; 176 | libvo-aacenc is used by default. 177 | To install with libfaac, you can: 178 | brew reinstall ffmpeg --with-faac 179 | 180 | You can also use the experimental FFmpeg encoder, libfdk-aac, or 181 | libvo_aacenc to encode AAC audio: 182 | ffmpeg -i input.wav -c:a aac -strict experimental output.m4a 183 | Or: 184 | brew reinstall ffmpeg --with-fdk-aac 185 | ffmpeg -i input.wav -c:a libfdk_aac output.m4a 186 | EOS 187 | end 188 | end 189 | 190 | test do 191 | # Create an example mp4 file 192 | system "#{bin}/ffmpeg", "-y", "-filter_complex", 193 | "testsrc=rate=1:duration=1", "#{testpath}/video.mp4" 194 | assert (testpath/"video.mp4").exist? 195 | end 196 | end 197 | 198 | __END__ 199 | diff --git a/common.mak b/common.mak 200 | index 20b7fa3..2851b33 100644 201 | --- a/common.mak 202 | +++ b/common.mak 203 | @@ -37,7 +37,8 @@ CPPFLAGS := $(IFLAGS) $(CPPFLAGS) 204 | CFLAGS += $(ECFLAGS) 205 | CCFLAGS = $(CPPFLAGS) $(CFLAGS) 206 | ASFLAGS := $(CPPFLAGS) $(ASFLAGS) 207 | -CXXFLAGS += $(CPPFLAGS) $(CFLAGS) 208 | +STDC99FLAG := -std=c99 209 | +CXXFLAGS += $(CPPFLAGS) $(filter-out $(STDC99FLAG),$(CFLAGS)) 210 | YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm 211 | 212 | HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) 213 | --------------------------------------------------------------------------------