From patchwork Sun Oct 7 16:02:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Molkentin X-Patchwork-Id: 10555 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:ab0:73d2:0:0:0:0:0 with SMTP id m18csp2672216uaq; Sun, 7 Oct 2018 09:03:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV62jcEuahJUG3j+pxs7jVIBT/mXlgXkKDers/orCH7J4Qfkb0R0aQzha2IhtqcTjJipB/kXA X-Received: by 2002:a1c:890:: with SMTP id 138-v6mr12373881wmi.128.1538928181699; Sun, 07 Oct 2018 09:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538928181; cv=none; d=google.com; s=arc-20160816; b=w9YH6za/3u+7s0cUNllGgr9+maJenBSwh/nwGbyIX7bmliqDEzfYuNSUAxaCL4TSEh NSu4L7Ilxs/ZZGpogmsg0/bY0WnDiPsFbjzdRgCsud0e+fey+//bA8lQQIRpbcPfiKTh pjs85Z5x7r8JbXL+QeqQRSPehrHunvHkNeSEsy/cJ6xr14HFNf6/Kq5rwLHBiHKfzSe3 5dld47Wr8h8dfpiNmcQ7L8ZSE56FzPg6PXVzftVreYd1olRSv/kZW4qK31Iecg7fmEeQ DtBOP2W5Klu2jc6GS3luv7tstygI2QB/9VUgx9zMwuWg58Zy+LkBjnbMvicRLgzwAbTq BSrA== 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=fvdwFpUPPrwYsJLRCl0V95c2HCdN7Fn8LV1nGxt38tY=; b=qqGGp/Eizq6GhJN1mBv+F4aA+tw2nNNfBkOZYPgnOcxJ3+WHNFqO+XRzJ8jYjAhWWr ruvZQ+/KOWeA0S+yitqxrGT34ciJOg7sWK5H3e6zfwr83pyU8vFayM1Sw/o5PflSgBZ0 lyPd9liFj+sHBBT/NTQ7aiWHrvP05Bm93p02XiQIxtFJKcvt7+Y8phouYnXf6ggBCDfv tsnIOFEc+bHcPmrRbd0Yyfjhl3CByeu5QlV59bkmWMp6I8EycQfRvSGt9W00LLDqzJSL OP1kQ8OgLrMpMyleAb7+HVRcJGp0L8QL6TeRZeZVLujFqgSxX+SnkCTudnE22OmgmH8k wDhA== 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 p19-v6si5779346wmh.109.2018.10.07.09.03.01; Sun, 07 Oct 2018 09:03:01 -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 730D3689FCE; Sun, 7 Oct 2018 19:02:29 +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 B2C65689FA0 for ; Sun, 7 Oct 2018 19:02:21 +0300 (EEST) Received: from localhost (localhost4.localdomain4 [127.0.0.1]) by mail.molkentin.net (Postfix) with ESMTP id EB655D035F; Sun, 7 Oct 2018 18:02:42 +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 cwWpSTgpKzod; Sun, 7 Oct 2018 18:02:42 +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 08912CFDEE; Sun, 7 Oct 2018 18:02:40 +0200 (CEST) From: Daniel Molkentin To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Oct 2018 18:02:25 +0200 Message-Id: <20181007160229.18250-2-daniel@molkentin.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181007160229.18250-1-daniel@molkentin.de> References: <20181007160229.18250-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 30a52c4fdb..bd5154f9be 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -19356,6 +19356,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;