Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags: specify tags for ITU-R BS.1770 programme loudness (LUFS) and true-peak level (dBTP) #831

Open
bb010g opened this issue May 27, 2024 · 5 comments
Labels
format addition spec_tags Tags Matroska spec document target

Comments

@bb010g
Copy link

bb010g commented May 27, 2024

The Matroska Media Container Tag Specifications should specify tags for programme loudness and programme true-peak level as specified by Rec. ITU-R BS.1770 (PDF) and as used by EBU R 128 (PDF). The programme loudness tag's value should be recorded in LUFS (called LKFS by the ITU), and the programme true-peak level tag's value should be recorded in dBFS. I propose the tag names ITU_BS_1770_LUFS and ITU_BS_1770_DBFS for these tags. These tags could be found at all TargetType levels (track, album, etc).

Currently, Tags specifies two tags for loudness information, REPLAYGAIN_GAIN and REPLAYGAIN_PEAK. These tags are based on the ReplayGain specification. However, ITU BS.1770 and EBU R 128 are increasingly being used in production & playback of both audio & video, so being able to encode that metadata in Matroska containers without a custom tag would be nice.

Note that loudness in LUFS is chosen instead of a gain in DB or a relative loudness in LU, relative to some target loudness, because of how target loudness levels (in LUFS) can be arbitrarily chosen. For example, EBU R 128 targets -23.0 LUFS, Qobuz targets -18 LUFS, Apple Music targets -16 LUFS, and YouTube targets -14 LUFS. REPLAYGAIN_GAIN is specified to always target 89dB SPL, but we have an opportunity to be less opinionated with ITU_BS_1770_LUFS. By being clear about this not being a relative loudness, we can hopefully avoid people changing tag values when their target changes. (Audio players can support user-specified target values for ReplayGain that aren't 89dB SPL, but specifying objective LUFS makes it more clear to implementers that target loudness should be controllable by the user.) Similarly, ITU_BS_1770_DBFS is an objective measurement that can be easily used to meet an arbitrary dBFS target by an audio player.

If it's desired to have a BS.1770-based equivalent for ReplayGain Track/Album Range tags (not appearing in this specification, but somewhat commonly used), then I propose the tag EBU_TECH_3342_LRA which would record the (programme) loudness range in LU as specified by EBU Tech 3342 (PDF). I'd like to choose a more objective measurement, but calculating reasonable loudness ranges requires decisions about sliding analysis-window length and loudness thresholds.

@robUx4 robUx4 added spec_tags Tags Matroska spec document target format addition labels Oct 12, 2024
@robUx4
Copy link
Contributor

robUx4 commented Oct 24, 2024

What would be the format of these values ?

  • It seems the ITU_BS_1770_LUFS would be a value in LUFS. But as you mention, different system/vendors have a different reference. So how do we tell which reference is used ? Tags can only have UTF-8 strings or binary data. Given parsing strings into a floating point value is not clean, we should probably use a binary format. We could put a single float or a fixed float with an extra one for the reference to use.

  • ITU_BS_1770_DBFS from the name would be in decibels (dB) ? it should also be a float in binary format.

The track/album should probably use the same tag but with different tag targets. But it seems the algorithm for EBU 3342 is slightly different (3s window). So it could be using a different tag name as well.

robUx4 added a commit to robUx4/matroska-specification that referenced this issue Oct 24, 2024
@robUx4
Copy link
Contributor

robUx4 commented Oct 24, 2024

For the record Opus in Ogg also add R128_TRACK_GAIN and R128_ALBUM_GAIN. There integer number values stored as a string, but it has to be converted to float. https://en.wikipedia.org/wiki/Q_(number_format)

robUx4 added a commit to robUx4/matroska-specification that referenced this issue Oct 25, 2024
@robUx4
Copy link
Contributor

robUx4 commented Oct 25, 2024

See #865 for an implementation of this.

robUx4 added a commit to robUx4/matroska-specification that referenced this issue Oct 26, 2024
@bb010g
Copy link
Author

bb010g commented Oct 27, 2024

What would be the format of these values ?

I'm not familiar enough to presume recommending any formats here.

  • It seems the ITU_BS_1770_LUFS would be a value in LUFS. But as you mention, different system/vendors have a different reference. So how do we tell which reference is used ?

That value is in LUFS, which would be independent of whatever a system/vendor chooses to normalize to. See equation 2 & page 7 in Rec. ITU-R BS.1770-5, where it's referred to as "LKFS". Multiple vendors can normalize to their respective arbitrary loudnesses using the same ITU_BS_1770_LUFS tag value.

  • ITU_BS_1770_DBFS from the name would be in decibels (dB) ?

It would be in decibels relative to full scale (dBFS), which is also not a relative number.

@robUx4
Copy link
Contributor

robUx4 commented Nov 3, 2024

Multiple vendors can normalize to their respective arbitrary loudnesses using the same ITU_BS_1770_LUFS tag value.

This cannot work. Either we fix a reference and the source adapts the value to that reference, or we add an extra value on the side which is written based on what the source uses. The former seems easier to use and safer (and smaller). That's what I went with in #865 with a reference of -23 LUFS which seems to be the most common.

robUx4 added a commit to robUx4/matroska-specification that referenced this issue Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format addition spec_tags Tags Matroska spec document target
Projects
None yet
Development

No branches or pull requests

2 participants