[FFmpeg-devel] [PATCH v1 2/4] avfilter/af_loudnorm: Add compact mode to simplify stats parsing
lance.lmwang at gmail.com
lance.lmwang at gmail.com
Thu Apr 9 14:07:18 EEST 2020
From: Limin Wang <lance.lmwang at gmail.com>
Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
doc/filters.texi | 2 +-
libavfilter/af_loudnorm.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 738a40df4e..19171d48dc 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -4283,7 +4283,7 @@ Multi-channel input files are not affected by this option.
Options are true or false. Default is false.
@item print_format
-Set print format for stats. Options are summary, json, or none.
+Set print format for stats. Options are summary, json, compact or none.
Default value is none.
@item file, f
diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
index bf530195e4..3012aa2471 100644
--- a/libavfilter/af_loudnorm.c
+++ b/libavfilter/af_loudnorm.c
@@ -48,6 +48,7 @@ enum PrintFormat {
NONE,
JSON,
SUMMARY,
+ COMPACT,
PF_NB
};
@@ -124,6 +125,7 @@ static const AVOption loudnorm_options[] = {
{ "none", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NONE}, 0, 0, FLAGS, "print_format" },
{ "json", 0, 0, AV_OPT_TYPE_CONST, {.i64 = JSON}, 0, 0, FLAGS, "print_format" },
{ "summary", 0, 0, AV_OPT_TYPE_CONST, {.i64 = SUMMARY}, 0, 0, FLAGS, "print_format" },
+ { "compact", 0, 0, AV_OPT_TYPE_CONST, {.i64 = COMPACT}, 0, 0, FLAGS, "print_format" },
{ "file", "set file path for the measured stats", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, FLAGS },
{ "f", "set file path for the measured stats", OFFSET(filename), AV_OPT_TYPE_STRING, {.str=NULL}, FLAGS },
{ NULL }
@@ -909,6 +911,16 @@ static av_cold void uninit(AVFilterContext *ctx)
);
break;
+ case COMPACT:
+ s->print(ctx, "input_i: %.2f, input_tp: %.2f, input_lra: %.2f, input_thresh: %.2f, "
+ "output_i: %.2f, output_tp: %.2f, output_lra: %.2f, output_thresh: %.2f, "
+ "normalization_type: %s, target_offset: %.2f\n",
+ i_in, 20. * log10(tp_in), lra_in, thresh_in,
+ i_out, 20. * log10(tp_out), lra_out, thresh_out,
+ s->frame_type == LINEAR_MODE ? "linear" : "dynamic",
+ s->target_i - i_out);
+ break;
+
case SUMMARY:
s->print(ctx,
"\n"
--
2.21.0
More information about the ffmpeg-devel
mailing list