From patchwork Sun Oct 7 21:19:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Molkentin X-Patchwork-Id: 10580 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:ab0:73d2:0:0:0:0:0 with SMTP id m18csp2900858uaq; Sun, 7 Oct 2018 14:20:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV62cAH2O2O2+HRSoAELOfEdQSGcl4nwHoIsvJX19XsP+y0MlKUlFRnCdoSWKfNdZM/qNIslo X-Received: by 2002:a05:6000:124e:: with SMTP id j14mr13516829wrx.315.1538947229710; Sun, 07 Oct 2018 14:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538947229; cv=none; d=google.com; s=arc-20160816; b=d7z+WnKHiQ3/JJh33PgVphcjx1ApRBepwHcWCETTkyJi/KigfPATNTJBwKQ5hogxuX t+8VXcPGx6Ns87/IEtxLQJQhvEOwRn1WXxwHHUZejgJm6pllCL937Xgh/FIALu6kQJSZ Ip+OhNqkjaFo912GSpu4tiuYTGmQiad5RInpzN1BAoB74XI3RUcqktsu/jyNmkQ7tEpv HF9xhnc/whYeUwCHnrXyqqh0q0Y34tYUe4IYgcPWXqSYV0l+mQZD7jA2hpHLeB/87HeA +ZFgvcolILuDHkW+O1iGToOfA+Zh9pznASYHkdMuy7KPfVxEBXVxPsLS5i2meUYKMF0D L7dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=B+6l1YZgppDU+HyFYCEVvB1Z2Io603T+AuzPFNxAmI4=; b=M0+wRBuGfxEeCaUP/abNXgukphDzy3qLILrJ1ftPHOCs0OaqeZLqpl6vmJgKmM3l3l YI4sVNFQyItSdsU4QLrKqh420EiN4bXSxTCFULnSN9igDyEfiLz9K2xgnvwAJ0LMpLEx OHTSNSLDlEWhHqRoNcuJTIeeyeraki06WB4A5mV2/S62zw9SgNpIJOvO8JR/kyYD56Pv qgAGuSjovggAuuE5CDibzosuQaNH4nD9Uqg/eIWmmt/KE+0TrcU4S1hqKNQ+6h8itlkl SOGszBahjqViGMlab5raVECJezJmx1H2nFPnzM1CfbH0jrVtK5j5DW5ns4vFQI38HbUY oOXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n13-v6si11785041wrw.334.2018.10.07.14.20.29; Sun, 07 Oct 2018 14:20:29 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 65432680349; Mon, 8 Oct 2018 00:20:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.molkentin.net (mail.molkentin.net [138.201.121.149]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C823D689FCE for ; Mon, 8 Oct 2018 00:19:54 +0300 (EEST) Received: from localhost (localhost4.localdomain4 [127.0.0.1]) by mail.molkentin.net (Postfix) with ESMTP id 2F34BE32F8; Sun, 7 Oct 2018 23:20:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at example.com Received: from mail.molkentin.net ([127.0.0.1]) by localhost (mail.molkentin.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VtUYnw7A0YGF; Sun, 7 Oct 2018 23:20:15 +0200 (CEST) Received: from oldnewthing.club.berlin.ccc.de (dancefloor-nat.fuckup.club.berlin.ccc.de [195.160.172.42]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: daniel@molkentin.de) by mail.molkentin.net (Postfix) with ESMTPSA id 3B992E2FEA; Sun, 7 Oct 2018 23:20:14 +0200 (CEST) From: Daniel Molkentin To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Oct 2018 23:19:52 +0200 Message-Id: <20181007211956.17615-2-daniel@molkentin.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181007211956.17615-1-daniel@molkentin.de> References: <20181007211956.17615-1-daniel@molkentin.de> Subject: [FFmpeg-devel] [PATCH 1/5] libavfilter/ebur128: add target level option for EBUR128 visualization filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Conrad Zelck , Daniel Molkentin MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Daniel Molkentin Signed-off-by: Conrad Zelck --- 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. + +@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;