2 desc "Play, record, convert, and stream audio and video"
3 homepage "https://ffmpeg.org/"
4 url "https://ffmpeg.org/releases/ffmpeg-3.0.1.tar.bz2"
5 sha256 "f7f7052c120f494dd501f96becff9b5a4ae10cfbde97bc2f1e9f0fd6613a4984"
6 head "https://github.com/FFmpeg/FFmpeg.git"
9 sha256 "754cd2da64d2dda3aab3bca329757e102c781678ee9289e3ed238f5a639229cf" => :el_capitan
10 sha256 "b9a08881ea2053b739b92cb7dfdef4ce704ffef1776c68173e5e08c996c94004" => :yosemite
11 sha256 "1ce859c211f6759e1eac392ca85f91f99d89e464520312edd9f96618e97626b3" => :mavericks
14 option "without-x264", "Disable H.264 encoder"
15 option "without-lame", "Disable MP3 encoder"
16 option "without-xvid", "Disable Xvid MPEG-4 video encoder"
17 option "without-qtkit", "Disable deprecated QuickTime framework"
19 option "with-rtmpdump", "Enable RTMP protocol"
20 option "with-libass", "Enable ASS/SSA subtitle format"
21 option "with-opencore-amr", "Enable Opencore AMR NR/WB audio format"
22 option "with-openjpeg", "Enable JPEG 2000 image format"
23 option "with-openssl", "Enable SSL support"
24 option "with-libssh", "Enable SFTP protocol via libssh"
25 option "with-schroedinger", "Enable Dirac video format"
26 option "with-ffplay", "Enable FFplay media player"
27 option "with-tools", "Enable additional FFmpeg tools"
28 option "with-fdk-aac", "Enable the Fraunhofer FDK AAC library"
29 option "with-libvidstab", "Enable vid.stab support for video stabilization"
30 option "with-x265", "Enable x265 encoder"
31 option "with-libsoxr", "Enable the soxr resample library"
32 option "with-webp", "Enable using libwebp to encode WEBP images"
33 option "with-zeromq", "Enable using libzeromq to receive commands sent through a libzeromq client"
34 option "with-snappy", "Enable Snappy library"
35 option "with-dcadec", "Enable dcadec library"
36 option "with-rubberband", "Enable rubberband library"
37 option "with-zimg", "Enable z.lib zimg library"
38 option "with-openh264", "Enable OpenH264 library"
40 depends_on "pkg-config" => :build
42 # manpages won't be built without texi2html
43 depends_on "texi2html" => :build
44 depends_on "yasm" => :build
46 depends_on "x264" => :recommended
47 depends_on "lame" => :recommended
48 depends_on "xvid" => :recommended
50 depends_on "faac" => :optional
51 depends_on "fontconfig" => :optional
52 depends_on "freetype" => :optional
53 depends_on "theora" => :optional
54 depends_on "libvorbis" => :optional
55 depends_on "libvpx" => :optional
56 depends_on "rtmpdump" => :optional
57 depends_on "opencore-amr" => :optional
58 depends_on "libass" => :optional
59 depends_on "openjpeg" => :optional
60 depends_on "sdl" if build.with? "ffplay"
61 depends_on "snappy" => :optional
62 depends_on "speex" => :optional
63 depends_on "schroedinger" => :optional
64 depends_on "fdk-aac" => :optional
65 depends_on "opus" => :optional
66 depends_on "frei0r" => :optional
67 depends_on "libcaca" => :optional
68 depends_on "libbluray" => :optional
69 depends_on "libsoxr" => :optional
70 depends_on "libvidstab" => :optional
71 depends_on "x265" => :optional
72 depends_on "openssl" => :optional
73 depends_on "libssh" => :optional
74 depends_on "webp" => :optional
75 depends_on "zeromq" => :optional
76 depends_on "libbs2b" => :optional
77 depends_on "dcadec" => :optional
78 depends_on "rubberband" => :optional
79 depends_on "zimg" => :optional
80 depends_on "openh264" => :optional
85 args = ["--prefix=#{prefix}",
90 "--enable-hardcoded-tables",
91 "--enable-avresample",
93 "--host-cflags=#{ENV.cflags}",
94 "--host-ldflags=#{ENV.ldflags}",
97 args << "--enable-opencl" if MacOS.version > :lion
99 args << "--enable-libx264" if build.with? "x264"
100 args << "--enable-libmp3lame" if build.with? "lame"
101 args << "--enable-libxvid" if build.with? "xvid"
102 args << "--enable-libsnappy" if build.with? "snappy"
104 args << "--enable-libfontconfig" if build.with? "fontconfig"
105 args << "--enable-libfreetype" if build.with? "freetype"
106 args << "--enable-libtheora" if build.with? "theora"
107 args << "--enable-libvorbis" if build.with? "libvorbis"
108 args << "--enable-libvpx" if build.with? "libvpx"
109 args << "--enable-librtmp" if build.with? "rtmpdump"
110 args << "--enable-libopencore-amrnb" << "--enable-libopencore-amrwb" if build.with? "opencore-amr"
111 args << "--enable-libfaac" if build.with? "faac"
112 args << "--enable-libass" if build.with? "libass"
113 args << "--enable-ffplay" if build.with? "ffplay"
114 args << "--enable-libssh" if build.with? "libssh"
115 args << "--enable-libspeex" if build.with? "speex"
116 args << "--enable-libschroedinger" if build.with? "schroedinger"
117 args << "--enable-libfdk-aac" if build.with? "fdk-aac"
118 args << "--enable-openssl" if build.with? "openssl"
119 args << "--enable-libopus" if build.with? "opus"
120 args << "--enable-frei0r" if build.with? "frei0r"
121 args << "--enable-libcaca" if build.with? "libcaca"
122 args << "--enable-libsoxr" if build.with? "libsoxr"
123 args << "--enable-libvidstab" if build.with? "libvidstab"
124 args << "--enable-libx265" if build.with? "x265"
125 args << "--enable-libwebp" if build.with? "webp"
126 args << "--enable-libzmq" if build.with? "zeromq"
127 args << "--enable-libbs2b" if build.with? "libbs2b"
128 args << "--enable-libdcadec" if build.with? "dcadec"
129 args << "--enable-librubberband" if build.with? "rubberband"
130 args << "--enable-libzimg" if build.with? "zimg"
131 args << "--disable-indev=qtkit" if build.without? "qtkit"
132 args << "--enable-libopenh264" if build.with? "openh264"
134 if build.with? "openjpeg"
135 args << "--enable-libopenjpeg"
136 args << "--disable-decoder=jpeg2000"
137 args << "--extra-cflags=" + `pkg-config --cflags libopenjpeg`.chomp
140 # These librares are GPL-incompatible, and require ffmpeg be built with
141 # the "--enable-nonfree" flag, which produces unredistributable libraries
142 if %w[faac fdk-aac openssl].any? { |f| build.with? f }
143 args << "--enable-nonfree"
146 # A bug in a dispatch header on 10.10, included via CoreFoundation,
147 # prevents GCC from building VDA support. GCC has no problems on
149 # See: https://github.com/Homebrew/homebrew/issues/33741
150 if MacOS.version < :yosemite || ENV.compiler == :clang
151 args << "--enable-vda"
153 args << "--disable-vda"
156 # For 32-bit compilation under gcc 4.2, see:
157 # https://trac.macports.org/ticket/20938#comment:22
158 ENV.append_to_cflags "-mdynamic-no-pic" if Hardware.is_32_bit? && Hardware::CPU.intel? && ENV.compiler == :clang
160 system "./configure", *args
162 if MacOS.prefer_64_bit?
163 inreplace "config.mak" do |s|
164 shflags = s.get_make_var "SHFLAGS"
165 if shflags.gsub!(" -Wl,-read_only_relocs,suppress", "")
166 s.change_make_var! "SHFLAGS", shflags
171 system "make", "install"
173 if build.with? "tools"
174 system "make", "alltools"
175 bin.install Dir["tools/*"].select { |f| File.executable? f }
180 if build.without? "faac" then <<-EOS.undent
181 The native FFmpeg AAC encoder has been stable since FFmpeg 3.0. If you
182 were using libvo-aacenc or libaacplus, both of which have been dropped in
183 FFmpeg 3.0, please consider switching to the native encoder (-c:a aac),
184 fdk-aac (-c:a libfdk_aac, ffmpeg needs to be installed with the
185 --with-fdk-aac option), or faac (-c:a libfaac, ffmpeg needs to be
186 installed with the --with-faac option).
189 https://ffmpeg.org/index.html#removing_external_aac_encoders for details,
190 and https://trac.ffmpeg.org/wiki/Encode/AAC on best practices of encoding
197 # Create an example mp4 file
198 system "#{bin}/ffmpeg", "-y", "-filter_complex",
199 "testsrc=rate=1:duration=1", "#{testpath}/video.mp4"
200 assert (testpath/"video.mp4").exist?
205 diff --git a/libavfilter/vf_owdenoise.c b/libavfilter/vf_owdenoise.c
206 index 3a77f89..6becccc 100644
207 --- a/libavfilter/vf_owdenoise.c
208 +++ b/libavfilter/vf_owdenoise.c
209 @@ -222,7 +222,6 @@ static void filter(OWDenoiseContext *s,
211 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
214 AVFilterContext *ctx = inlink->dst;
215 OWDenoiseContext *s = ctx->priv;
216 AVFilterLink *outlink = ctx->outputs[0];
217 @@ -231,8 +230,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
218 const int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub);
220 if (av_frame_is_writable(in)) {
224 + if (s->luma_strength > 0)
225 + filter(s, out->data[0], out->linesize[0], in->data[0], in->linesize[0], inlink->w, inlink->h, s->luma_strength);
226 + if (s->chroma_strength > 0) {
227 + filter(s, out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, s->chroma_strength);
228 + filter(s, out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, s->chroma_strength);
231 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
233 @@ -240,13 +245,20 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
234 return AVERROR(ENOMEM);
236 av_frame_copy_props(out, in);
239 - filter(s, out->data[0], out->linesize[0], in->data[0], in->linesize[0], inlink->w, inlink->h, s->luma_strength);
240 - filter(s, out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, s->chroma_strength);
241 - filter(s, out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, s->chroma_strength);
242 + if (s->luma_strength > 0) {
243 + filter(s, out->data[0], out->linesize[0], in->data[0], in->linesize[0], inlink->w, inlink->h, s->luma_strength);
245 + av_image_copy_plane(out->data[0], out->linesize[0], in ->data[0], in ->linesize[0], inlink->w, inlink->h);
247 + if (s->chroma_strength > 0) {
248 + filter(s, out->data[1], out->linesize[1], in->data[1], in->linesize[1], cw, ch, s->chroma_strength);
249 + filter(s, out->data[2], out->linesize[2], in->data[2], in->linesize[2], cw, ch, s->chroma_strength);
251 + av_image_copy_plane(out->data[1], out->linesize[1], in ->data[1], in ->linesize[1], inlink->w, inlink->h);
252 + av_image_copy_plane(out->data[2], out->linesize[2], in ->data[2], in ->linesize[2], inlink->w, inlink->h);
257 av_image_copy_plane(out->data[3], out->linesize[3],
258 in ->data[3], in ->linesize[3],