[FFmpeg-devel] [PATCH] avfilter: add loudnorm
krueger at lesspain.software
Tue May 10 18:56:47 CEST 2016
On Mon, May 9, 2016 at 9:40 PM, Kyle Swanson <k at ylo.ph> wrote:
> On Tue, Apr 5, 2016 at 7:01 PM, Kyle Swanson <k at ylo.ph> wrote:
> > Here's another audio filter. I hinted at this a few months ago, but I
> found out that
> > finishing the last 5% took almost as long as the first 95%. This is an
> EBU R128
> > dynamic loudness normalization filter. This filter uses libebur128
> v1.1.0 and must be
> > configured with `--enable-libebur128'. Please also see the accompanying
> blog post
> > which has an algorithm description, as well as some usage instructions.
> >  https://github.com/jiixyj/libebur128
> >  http://k.ylo.ph/2016/04/04/loudnorm.html
> > Thanks!
> > Kyle
> I think there was a little bit of confusion about what this filter
> does, and why exactly it links libebur128. I'm not sure if anyone
> actually reviewed the patch, since all of the discussion was about
> libebur128. I didn't quite provide it the first time, so here's some
> background information and rationale for linking libebur128.
> Most broadcasters are now specifying mandatory loudness targets for
> source material, which is usually supplied as a target integrated
> loudness value and a target maximum true peak. Loudness normalization
> is easy for files with sufficient headroom for linear gain
> adjustments, difficult for files with not enough headroom, and even
> more difficult for live streams – this filter handles all these
> situations. The loudnorm algo is basically a loudness-tuned AGC which
> was designed to honor local dynamics, followed by a look-ahead true
> peak limiter. Using normal parameters the result is usually
> imperceptible, even with very dynamic source material such as
> classical music. This filter should be a major boon to broadcasters
> and digital distribution people, since the only software currently
> available that does this kind of thing is commercial, and for the most
> part very expensive (Minnetonka, Skylark, Nugen, etc.)
> FFmpeg has a native ebur128 filter which already has all the EBU R128
> logic baked in, but I chose to link libebur128 with the loudnorm
> filter for a couple of reasons. If all it needed was an input
> measurement, it would certainly be easy to just export the frame meta
> from the ebur128 filter, but the loudnorm algorithm needs loudness
> measurements from a couple of different places in the signal chain
> making this solution impossible. I thought about extracting the FFmpeg
> ebur128 functions so they could be reused elsewhere in FFmpeg, but the
> R128 logic from the ebur128 filter is quite tangled, tied to filter
> functions, internal states are spread out between several structs, and
> is not easily extracted into a reusable API. Ideally, someone could
> take a crack at extracting the FFmpeg ebur128 logic, but in the
> meantime I chose to link libebur128 with the loudnorm filter.
> libebur128 is well known and used R128 library.
> True this adds a dependency and seems a little redundant, but this is
> a filter and not a core part of FFmpeg. Many filters link special
> libraries, users can choose to either configure and compile with the
> library or not, and if they don't then the filter won't be enabled on
> their builds. Maybe I'm wrong, but I don't see it as a huge issue. If
> I or someone else gets the time to rewrite FFmpeg's ebur128 filter
> down the road, it should be easy to update this filter to use FFmpeg's
> ebur128 measurements.
> Updated and rebased patch is attached, please review.
this is a great addition, thanks a lot for your work! Another factor that
(at least for some people) is an argument for your approach, is the fact
that the existing ebur128 filter is GPL which makes ist unusable in an
environment that needs LGPL.
More information about the ffmpeg-devel