Re: [codec] OggOpus: Rational for excluding replaygain tags?

Calvin Walton <> Wed, 07 November 2012 17:53 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 49E4C21F8878 for <>; Wed, 7 Nov 2012 09:53:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id PgrE-AvkFW-d for <>; Wed, 7 Nov 2012 09:53:26 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id 0B07721F8792 for <>; Wed, 7 Nov 2012 09:53:24 -0800 (PST)
Received: by with SMTP id x24so1461614iak.31 for <>; Wed, 07 Nov 2012 09:53:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=google; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version; bh=jXXf7WVMCQXPHG2wz9VU7IRsLJjnDG+W+eI4TcqFjgI=; b=JiYNAtj+V9O+noj15iknJA+t737LNUrL9pHaj96PvZ6g6al9NTVMmNc4Bbyi1nVma7 CaVX22hUSrsT3Dl5zhgTUpkjvuBlU4PIfaSnZ5u1oNJG7PV3ni8wyfMqVzdCs0mqB2vI CWwzDgFw/JEbrKmDNpxkkQKHAKd4Ao8eHmQWY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version:x-gm-message-state; bh=jXXf7WVMCQXPHG2wz9VU7IRsLJjnDG+W+eI4TcqFjgI=; b=fgVwKo4lvGRHFesiYR9p6MHdvNGeY57og1Akflnq0rtOqa/SzWFU7quK0lzZCTKQ48 +DKQtBGiI9IQCimDp27RtRWhK+9cFk0ZotvEOXCGV11S+JWA/wot1P0RZ/phqoPQUksC oPkYWGDZUURq+BpMfeADJeGk4mdCyJFQKqFenEcgWghgVJ6J34Nl8niXaWa4pxgejUwy tpYCpVFY5Cul122rPUl/pt5GI96nph/xehDX/+E6bxXK68x1fpPC7ziUkwdhEFQPEKnA F+8FWF+NJFnyhp5rvoYN7k6kLoylsPdgSTbYiH3aVkRiGLuVvo2PoC6m4HknfGgnjnEU U/zw==
Received: by with SMTP id cg3mr17340836igb.57.1352310804478; Wed, 07 Nov 2012 09:53:24 -0800 (PST)
Received: from [] ([]) by with ESMTPS id b13sm2577171igp.7.2012. (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 09:53:22 -0800 (PST)
Message-ID: <1352310799.14547.48.camel@ayu>
From: Calvin Walton <>
To: Ralph Giles <>
Date: Wed, 07 Nov 2012 12:53:19 -0500
In-Reply-To: <>
References: <1352307794.14547.30.camel@ayu> <>
Content-Type: multipart/signed; micalg="sha1"; protocol="application/x-pkcs7-signature"; boundary="=-zySJtAjYhhJUgVFbX91t"
X-Mailer: Evolution 3.6.0
Mime-Version: 1.0
X-Gm-Message-State: ALoCoQk1scc1/ZXmoPKxt5J3Ee5uTeMuYsU+j4GRSDitAbnfRuuMm+ds9JxWZXaAC818YeNC3K5w
Subject: Re: [codec] OggOpus: Rational for excluding replaygain tags?
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Codec WG <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 07 Nov 2012 17:53:27 -0000

On Wed, 2012-11-07 at 09:22 -0800, Ralph Giles wrote:
> On 12-11-07 9:03 AM, Calvin Walton wrote:
> > I would suggest that instead of simply saying that the OggOpus file
> > SHOULD NOT contain the replaygain tags, it should say that they MAY be
> > present, and should specify how they are interpreted and applied (This
> > mainly would concern their relation to the stream "output gain").
> I think the idea was to encourage adoption of the R128 methods along
> with Opus, since R128 is both technically superiour and more officially
> standardized. I agree it would be useful to describe what to do if
> multiple tags are present, even if it remains SHOULD NOT.

As long as the behaviour is properly documented, saying 'SHOULD NOT' is
probably ok, even if I think it is a bit strong.

> I would say, "The R128 tag overrides any REPLAYGAIN tag which is
> present. Player MAY choose to apply REPLAYGAIN values, combined with the
> output gain from the OpusHead packet, if no R128 tag is present."

I think that the player should allow the user to optionally prefer
REPLAYGAIN over R128. The issue that I have is interoperability with
files in other formats, which do not have any standardized way of saving
R128 gain tags, but do have defined REPLAYGAIN mappings. Loudness
normalization is useless if you can't normalize everything to the same
standard :)

> > I would however recommend that the files still SHOULD NOT have the
> > REPLAYGAIN_{TRACK,ALBUM}_PEAK tags, as Opus does not have a bit-accurate
> > decoder specified, and the peak values will also vary based on the
> > sample rate selected for decoding.
> That's a useful distinction to maintain. I agree.
> The other issue is what encoders are doing. Are any of the applications
> you tested *setting* REPLAYGAIN tags on files they encode? Or is it just
> that you want some level equalization and your player doesn't currently
> support the R128 scheme during playback? The question is whether we have
> some hope of acheiving compliance with the idea as opposed, or if it's
> too late for that already.

As far as I know, there are no applications currently that automatically
set replaygain tags in Ogg Opus. This could change - e.g. once a
tag-editing element for Ogg Opus is added to Gstreamer, then Gstreamer
applications will automatically gain the ability to set replaygain tags.
I'm considering adapting the 'vorbisgain' utility to decode Opus for my
personal use, to normalize files in my collection.

In order to apply the values to the files that I have, I used a
format-agnostic replaygain calculation tool to get the values, and a
standard vorbis comment editor to set the values.

If you ask foobar2000 to generate replaygain tags on Ogg Opus, it
currently saves values in the header output gain (for album) and the
R128 track tag. It's unclear whether it actually uses the R128 algorithm
or if it uses Replaygain with a non-standard reference value.

Calvin Walton <>