[FFmpeg-cvslog] libavfilter/ebur128: add target level option for EBUR128 visualization filter

Daniel Molkentin git at videolan.org
Wed Oct 10 20:43:48 EEST 2018


ffmpeg | branch: master | Daniel Molkentin <daniel at molkentin.de> | Tue Oct  9 14:32:53 2018 +0200| [d95c5b003c04b33f212b43fe62bc1986eb41a11b] | committer: Paul B Mahol

libavfilter/ebur128: add target level option for EBUR128 visualization filter

Signed-off-by: Daniel Molkentin <daniel at molkentin.de>
Signed-off-by: Conrad Zelck <c.zelck at imail.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d95c5b003c04b33f212b43fe62bc1986eb41a11b
---

 doc/filters.texi        | 6 ++++++
 libavfilter/f_ebur128.c | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b523877cf3..86ea25bda8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -19358,6 +19358,12 @@ Multi-channel input files are not affected by this option.
 @item panlaw
 Set a specific pan law to be used for the measurement of dual mono files.
 This parameter is optional, and has a default value of -3.01dB.
+
+ at item target
+Set a specific target level (in LUFS) used as relative zero in the visualization.
+This parameter is optional and has a default value of -23LUFS as specified
+by EBU R128. However, material published online may prefer a level of -16LUFS
+(e.g. for use with podcasts or video platforms).
 @end table
 
 @subsection Examples
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index a48d3629ce..dfccbff5ec 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -142,6 +142,7 @@ typedef struct EBUR128Context {
     int metadata;                   ///< whether or not to inject loudness results in frames
     int dual_mono;                  ///< whether or not to treat single channel input files as dual-mono
     double pan_law;                 ///< pan law value used to calculate dual-mono measurements
+    int target;                     ///< target level in LUFS used to set relative zero LU in visualization
 } EBUR128Context;
 
 enum {
@@ -168,6 +169,7 @@ static const AVOption ebur128_options[] = {
         { "true",   "enable true-peak mode",   0, AV_OPT_TYPE_CONST, {.i64 = PEAK_MODE_TRUE_PEAKS},    INT_MIN, INT_MAX, A|F, "mode" },
     { "dualmono", "treat mono input files as dual-mono", OFFSET(dual_mono), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, A|F },
     { "panlaw", "set a specific pan law for dual-mono files", OFFSET(pan_law), AV_OPT_TYPE_DOUBLE, {.dbl = -3.01029995663978}, -10.0, 0.0, A|F },
+    { "target", "set a specific target level in LUFS (-23 to 0)", OFFSET(target), AV_OPT_TYPE_INT, {.i64 = -23}, -23, 0, V|F },
     { NULL },
 };
 
@@ -740,8 +742,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
                 int x, y, ret;
                 uint8_t *p;
 
-                const int y_loudness_lu_graph = lu_to_y(ebur128, loudness_3000 + 23);
-                const int y_loudness_lu_gauge = lu_to_y(ebur128, loudness_400  + 23);
+                const int y_loudness_lu_graph = lu_to_y(ebur128, loudness_3000 - ebur128->target);
+                const int y_loudness_lu_gauge = lu_to_y(ebur128, loudness_400  - ebur128->target);
 
                 /* draw the graph using the short-term loudness */
                 p = pic->data[0] + ebur128->graph.y*pic->linesize[0] + ebur128->graph.x*3;



More information about the ffmpeg-cvslog mailing list