... | ... |
@@ -12685,6 +12685,15 @@ stream for better peak accuracy. It logs a message for true-peak. |
12685 | 12685 |
This mode requires a build with @code{libswresample}. |
12686 | 12686 |
@end table |
12687 | 12687 |
|
12688 |
+@item dualmono |
|
12689 |
+Treat mono input files as "dual mono". If a mono file is intended for playback |
|
12690 |
+on a stereo system, its EBU R128 measurement will be perceptually incorrect. |
|
12691 |
+If set to @code{true}, this option will compensate for this effect. |
|
12692 |
+Multi-channel input files are not effected by this option. |
|
12693 |
+ |
|
12694 |
+@item panlaw |
|
12695 |
+Set a specific pan law to be used for the measurement of dual mono files. |
|
12696 |
+This parameter is optional, and has a default value of -3.01dB. |
|
12688 | 12697 |
@end table |
12689 | 12698 |
|
12690 | 12699 |
@subsection Examples |
... | ... |
@@ -139,6 +139,8 @@ typedef struct { |
139 | 139 |
/* misc */ |
140 | 140 |
int loglevel; ///< log level for frame logging |
141 | 141 |
int metadata; ///< whether or not to inject loudness results in frames |
142 |
+ int dual_mono; ///< whether or not to treat single channel input files as dual-mono |
|
143 |
+ double pan_law; ///< pan law value used to calulate dual-mono measurements |
|
142 | 144 |
} EBUR128Context; |
143 | 145 |
|
144 | 146 |
enum { |
... | ... |
@@ -163,6 +165,8 @@ static const AVOption ebur128_options[] = { |
163 | 163 |
{ "none", "disable any peak mode", 0, AV_OPT_TYPE_CONST, {.i64 = PEAK_MODE_NONE}, INT_MIN, INT_MAX, A|F, "mode" }, |
164 | 164 |
{ "sample", "enable peak-sample mode", 0, AV_OPT_TYPE_CONST, {.i64 = PEAK_MODE_SAMPLES_PEAKS}, INT_MIN, INT_MAX, A|F, "mode" }, |
165 | 165 |
{ "true", "enable true-peak mode", 0, AV_OPT_TYPE_CONST, {.i64 = PEAK_MODE_TRUE_PEAKS}, INT_MIN, INT_MAX, A|F, "mode" }, |
166 |
+ { "dualmono", "treat mono input files as dual-mono", OFFSET(dual_mono), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, A|F }, |
|
167 |
+ { "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 }, |
|
166 | 168 |
{ NULL }, |
167 | 169 |
}; |
168 | 170 |
|
... | ... |
@@ -661,6 +665,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) |
661 | 661 |
} |
662 | 662 |
if (nb_integrated) |
663 | 663 |
ebur128->integrated_loudness = LOUDNESS(integrated_sum / nb_integrated); |
664 |
+ /* dual-mono correction */ |
|
665 |
+ if (nb_channels == 1 && ebur128->dual_mono) { |
|
666 |
+ ebur128->integrated_loudness -= ebur128->pan_law; |
|
667 |
+ } |
|
664 | 668 |
} |
665 | 669 |
|
666 | 670 |
/* LRA */ |
... | ... |
@@ -707,6 +715,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) |
707 | 707 |
} |
708 | 708 |
} |
709 | 709 |
|
710 |
+ /* dual-mono correction */ |
|
711 |
+ if (nb_channels == 1 && ebur128->dual_mono) { |
|
712 |
+ loudness_400 -= ebur128->pan_law; |
|
713 |
+ loudness_3000 -= ebur128->pan_law; |
|
714 |
+ } |
|
715 |
+ |
|
710 | 716 |
#define LOG_FMT "M:%6.1f S:%6.1f I:%6.1f LUFS LRA:%6.1f LU" |
711 | 717 |
|
712 | 718 |
/* push one video frame */ |
... | ... |
@@ -855,6 +869,14 @@ static av_cold void uninit(AVFilterContext *ctx) |
855 | 855 |
int i; |
856 | 856 |
EBUR128Context *ebur128 = ctx->priv; |
857 | 857 |
|
858 |
+ /* dual-mono correction */ |
|
859 |
+ if (ebur128->nb_channels == 1 && ebur128->dual_mono) { |
|
860 |
+ ebur128->i400.rel_threshold -= ebur128->pan_law; |
|
861 |
+ ebur128->i3000.rel_threshold -= ebur128->pan_law; |
|
862 |
+ ebur128->lra_low -= ebur128->pan_law; |
|
863 |
+ ebur128->lra_high -= ebur128->pan_law; |
|
864 |
+ } |
|
865 |
+ |
|
858 | 866 |
av_log(ctx, AV_LOG_INFO, "Summary:\n\n" |
859 | 867 |
" Integrated loudness:\n" |
860 | 868 |
" I: %5.1f LUFS\n" |