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

Calvin Walton <> Tue, 27 November 2012 07:36 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id F3E8F21F853C for <>; Mon, 26 Nov 2012 23:36:20 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.785
X-Spam-Status: No, score=-1.785 tagged_above=-999 required=5 tests=[AWL=-1.815, BAYES_00=-2.599, FB_INCREASE_VOL=3.629, RCVD_IN_DNSWL_LOW=-1]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 33jnywtkeqk0 for <>; Mon, 26 Nov 2012 23:36:20 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id 08F1521F8565 for <>; Mon, 26 Nov 2012 23:36:19 -0800 (PST)
Received: by with SMTP id c13so11208714ieb.31 for <>; Mon, 26 Nov 2012 23:36:19 -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:content-transfer-encoding; bh=3X/GakxigwZ7XrfCKjjuN1IAb2Opvejsbc5FChxfBYg=; b=btKggj++Ytup69NvjPw+3WyxaPN516H+Ga1TZJ8DAx2HouYCmct2i9ZB+dDfKKzJ7k UdR+2y1HRViSXQnETdY0xPoDGSvKPWyQAZuiE7iUGEth0P7RVAFlfDjevGMlg2XuobGu fb7JRPiA7wOe/8+lDZZPVLz2HFEP0SogZQ8aI=
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:content-transfer-encoding :x-gm-message-state; bh=3X/GakxigwZ7XrfCKjjuN1IAb2Opvejsbc5FChxfBYg=; b=JgagBOLW2zpnaUn007OIRH5UkVG3pIds7Zsqnb1UYyEewBheulm+HS6ZEUGjaiOqOK 84Fipz/sI06Ox5dIqb2E/PUQ1l45GcnzGNR9AuJL6BczGCqKEuJWBwdKiMNOUdXP+MdU G839zv9ZfCawTC8CvHTHr86v8IcgveIC4Aeo9AEjNrTosAraXTGPF3W8r/9k2cQXtM4a KzLE2KRpOrs4gKYR1xgfH6HY9ikXb4IgUYwN1Py4VEspczxkNRF2sEyVXZpc/aZb+jGL X0i8dLBuBUn6jUGcVqOH4fICTXfLIphVmMyIqvphHZjITFGH06O1kN9yNFEhTc7jO5Kh x5Sg==
Received: by with SMTP id bf2mr13028272icb.50.1354001779306; Mon, 26 Nov 2012 23:36:19 -0800 (PST)
Received: from [] ( []) by with ESMTPS id eo7sm1161565igc.12.2012. (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 23:36:18 -0800 (PST)
Message-ID: <>
From: Calvin Walton <>
To: Gregory Maxwell <>
Date: Tue, 27 Nov 2012 02:36:16 -0500
In-Reply-To: <>
References: <1352307794.14547.30.camel@ayu> <> , <1352328081.14547.82.camel@ayu> <> <>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.4.4
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Gm-Message-State: ALoCoQnqRCvWzrlYxPaMy1yLgSqab/rbX8amgKIen7+uqNeQsxuZzFPJdBMCMyXNU+TJwAOesalF
Cc: "" <>
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: Tue, 27 Nov 2012 07:36:21 -0000

On Mon, 2012-11-26 at 23:50 -0500, Calvin Walton wrote:
> On Mon, 2012-11-26 at 16:30 +0000, Gregory Maxwell wrote:
> > > Yes, having the standard gain header that is supported by all decoders
> > > is nice - except for the case of playback of mixed file formats,
> > > particularly by an application that doesn't understand the gain tags in
> > > other formats. In those cases, the Opus files will be significantly
> > > quieter (assuming modern pop mastering...) than the other files, making
> > > them sound "worse" than files without gain applied.
> > 
> > I don't see how you can usefully make an argument here.  If you don't
> > have gain adjustment (on the files or in the application) and you have
> > files from various sources you will have various levels.
> My argument is based on using a player that supports Opus playback,
> supports ReplayGain tags, but does not support R128 gain tags. This is
> the case with some current players (e.g. Rockbox, Rhythmbox).
> All of my existing Ogg Vorbis files with ReplayGain tags will be played
> back 5 dB louder than an Opus file with R128 album gain stored in the
> header gain field. (A workaround for this would be to use the ReplayGain
> preamp to apply a -5 dB gain after the ReplayGain adjustment.)
> Alternately, if the Opus file has a R128_TRACK_GAIN comment present, but
> 0 in the header gain field, it will be played back unnormalized!
> For the case of older versions of Rhythmbox running with a newer
> Gstreamer library backend that supports decoding Opus, this situation
> may be maintained for quite a while.

Sorry for the double post, but I wanted to elaborate on this a bit:

This is why I'm currently putting the Vorbis-style ReplayGain tags into
my Ogg Opus files - they are interoperable with existing players, and
work right now. For the time being, in my personal files I'm using the
following backwards- and hopefully forwards-compatible structure:

New logical stream (#1, serial: 00332868): type opus
Encoded with libopus 1.0.1
User comments section follows...
Opus stream 1:
	Pre-skip: 356
	Playback gain: -15.2891 dB

where the playback gain is an arbitrary number that bears a striking
resemblance to the R128 album gain, R128_TRACK_GAIN is a relative
adjustment to -23 LUFS reference, the REPLAYGAIN_*_GAIN comments are
relative adjustments to -14 LUFS reference (literally just the
corresponding R128 values +5 dB), and the REPLAYGAIN_*_PEAK tags contain
the peak after playback gain is applied, but before ReplayGain is

(Note that the ReplayGain peak tags are required to tell the GStreamer
'rgvolume' element that it is safe to increase the volume by 5 dB
without clipping; otherwise it will refuse to go above +0 dB.)

This gives me working volume normalization in all of the players that I
use regularly. Rhythmbox and Rockbox use the ReplayGain comments,
applied after the playback gain field. foobar2000 uses the R128 track
gain comment and the playback gain field (it assumes that playback gain
contains the R128 album gain), adjusts both +5 dB, then uses them as
ReplayGain values.

But the combination certainly looks really ugly, for what that's
worth :)

Calvin Walton <>