MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.38k stars 160 forks source link

REQ: consider supporting all (legitimate) ReplayGain info #582

Open atomGit opened 2 years ago

atomGit commented 2 years ago
Track range | REPLAYGAIN_TRACK_RANGE | [-]a.bb dB
Peak track amplitude | REPLAYGAIN_ALBUM_RANGE | [-]a.bb dB
Album replay gain | REPLAYGAIN_REFERENCE_LOUDNESS | [-]a.bb LUFS

spec: ReplayGain 2.0 specification

JeromeMartinez commented 2 years ago

Please a sample file.

atomGit commented 2 years ago

hi Jerome - why would a sample be needed? mediainfo simply doesn't have info params for these - the only RG info params are...

Album_ReplayGain_Gain     : The gain to apply to reach 89dB SPL on playback
Album_ReplayGain_Gain/String 
Album_ReplayGain_Peak     : The maximum absolute peak value of the item
ReplayGain_Gain           : The gain to apply to reach 89dB SPL on playback
ReplayGain_Gain/String 
ReplayGain_Peak           : The maximum absolute peak value of the item
JeromeMartinez commented 2 years ago

why would a sample be needed?

For seeing better what you miss in the current implementation, and have a file with "problem" in the regression test suite. No file --> not possible to test, and I don't implement something I can not test.

atomGit commented 2 years ago

i don't have a problem file - the file is irrelevant

the problem is that mediainfo has no info params for...

REPLAYGAIN_TRACK_RANGE
REPLAYGAIN_ALBUM_RANGE
REPLAYGAIN_REFERENCE_LOUDNESS
JeromeMartinez commented 2 years ago

We have no support of these tags, if they are displayed it is a "pass through" from the file directly in the output. So no info param needed there. If you want info params, I need a file with such fields, I'll check them, map to a MediaInfo field (no upper case etc), add info param. No file, no change (and certainly no info param because the fields you are requesting are not yet supported).

PS: I see in code that REPLAYGAIN_REFERENCE_LOUDNESS is listed and discarded, weird, it may be relevant, I'll check if I have a file with it.

atomGit commented 2 years ago

We have no support of these tags,

we're finally on the same page it seems :)

if they are displayed it is a "pass through" from the file directly in the output. So no info param needed there.

not so - how does one return the info without the info param and without grep'ing the command output? if the info param wasn't needed, then mediainfo wouldn't have any

if you're willing to add the missing params, let me know and i'll gladly supply a test file

thanks

atomGit commented 2 years ago

test - 16 bps, 44100 Hz, RG.tar.gz

file has RG spec tags for which mediainfo needs info params...

REPLAYGAIN_TRACK_RANGE
REPLAYGAIN_ALBUM_RANGE
REPLAYGAIN_REFERENCE_LOUDNESS
JeromeMartinez commented 2 years ago

Checking the file and the spec, I am lost. In the file REPLAYGAIN_ALBUM_GAIN is same as REPLAYGAIN_TRACK_GAIN, but maybe it is because it was only 1 file in an album, both are described as replay gain, it makes sense. But REPLAYGAIN_ALBUM_RANGE is same as REPLAYGAIN_TRACK_RANGE, but REPLAYGAIN_ALBUM_RANGE is described as "Peak track amplitude" and REPLAYGAIN_TRACK_RANGE is described as "Track range", are "peak amplitude" and "range" synonym there?

Additionally, I see that REPLAYGAIN_ALBUM_RANGE = REPLAYGAIN_TRACK_PEAK = "Peak track amplitude", "ALBUM" in metadata name but for a track + RANGE == PEAK???

Please confirm that there are some typos in this link and what would be the descriptions from your point of view.

atomGit commented 2 years ago

i was wrong - i made the assumption that these 3 bits of RG info were part of the current spec because the developer of loudgain seems to be very knowledgeable, however even the man page for loudgain describes them as "extra" info and the hydrogen document confirms this, listing them as "De-Facto extensions" - it does appear they were part of the RG 1 spec however, but then were dropped

the confusion of the definitions may be because you're looking at different definitions for different metadata formats, but i would suggest that can be ignored

what i am 99.9% certain of is that loudgain calculates the values the same way regardless of the file format

and yes, the values are the same because the sample file i provided is a track, not an album, but they are different when you run loudgain -a on multiple files...

$ loudgain -a *
Track: split-track00.wav
 Loudness:     -inf LUFS
 Range:        0.00 dB
 Peak:     0.000000 (-inf dBTP)
 Gain:          inf dB

Track: split-track01.wav
 Loudness:   -10.30 LUFS
 Range:        7.21 dB
 Peak:     1.015473 (0.13 dBTP)
 Gain:        -7.70 dB

Track: split-track02.wav
 Loudness:   -12.61 LUFS
 Range:        9.23 dB
 Peak:     1.009434 (0.08 dBTP)
 Gain:        -5.39 dB

Album:
 Loudness:   -11.13 LUFS
 Range:       10.01 dB
 Peak:     1.015473 (0.13 dBTP)
 Gain:        -6.87 dB

so i don't know where you want to go with all this - because loudgain is such a great tool, and because the dev is quite knowledgeable and wouldn't have added the extra RG info without reason, my opinion would still be to add these info params i think

additional info from loudgain Enhanced mode -s e (--tag-mode e) ...

Since ReplayGain 2.0 works using the EBU R128 recommendation (but at the different target -18 LUFS), and -18 LUFS has been estimated to be "equal" to the old 89 dB SPL ReplayGain 1 standard, it would make no sense to give pseudo-dB values as a reference loudness. This is possibly the reason why the RG2 spec dropped this tag altogether, and this is the reason why I stick with real LUFS units in the REPLAYGAIN_REFERENCE_LOUDNESS tag, even when writing "dB" units elsewhere for compatibility with the ReplayGain 2.0 standard and older software.

JeromeMartinez commented 2 years ago

so i don't know where you want to go with all this

I am fine with it, when I understand the meanings. I discard the explanations from the link, too "buggy", I just add "Range" part.

In your example there are a track loudness and an album loudness, are both in tags? I see only one REPLAYGAIN_REFERENCE_LOUDNESS and I don't get it is a track thing, an album thing or something independent from track and album.

atomGit commented 2 years ago

hmmm... i must've forgot to add the -a option - see this one...

test - 16 bps, 44100 Hz, no tags.zip

JeromeMartinez commented 2 years ago

Same as the previous:

REPLAYGAIN_ALBUM_GAIN                    : -3.83 dB
REPLAYGAIN_ALBUM_PEAK                    : 0.957787
REPLAYGAIN_ALBUM_RANGE                   : 8.14 dB
REPLAYGAIN_REFERENCE_LOUDNESS            : -18.00 LUFS
REPLAYGAIN_TRACK_GAIN                    : -3.83 dB
REPLAYGAIN_TRACK_PEAK                    : 0.957787
REPLAYGAIN_TRACK_RANGE                   : 8.14 dB

7 items, 3 for track and 3 for album, and 1 for... The reference loudness is for all? Useful to display?

atomGit commented 2 years ago

well, this is a single track so yes, the reference loudness is for "all"

maybe i'm not understanding exactly what you need - is it multiple tracks you want?

also, if you loudgain -a -s e an album file, the info is going to be the same because loudgain sees the file as a track whereas if you do the same with multiple files you'll get the result i did earlier

JeromeMartinez commented 2 years ago

I have 3 items per track or album. In loudgain output I see 4 items per track. Is the 4th in the metadata or is it only computed and not stored?

atomGit commented 2 years ago

metadata...

REPLAYGAIN_ALBUM_GAIN=-3.83 dB
REPLAYGAIN_ALBUM_PEAK=0.957787
REPLAYGAIN_ALBUM_RANGE=8.14 dB
REPLAYGAIN_REFERENCE_LOUDNESS=-18.00 LUFS
REPLAYGAIN_TRACK_GAIN=-3.83 dB
EPLAYGAIN_TRACK_PEAK=0.957787
REPLAYGAIN_TRACK_RANGE=8.14 dB

loudgain -a -s e ...

Track: test - 16 bps, 44100 Hz, no tags.flac
 Loudness:   -14.17 LUFS
 Range:        8.14 dB
 Peak:     0.957787 (-0.37 dBTP)
 Gain:        -3.83 dB

Album:
 Loudness:   -14.17 LUFS
 Range:        8.14 dB
 Peak:     0.957787 (-0.37 dBTP)
 Gain:        -3.83 dB
JeromeMartinez commented 2 years ago

Loudness: -14.17 LUFS

I don't find it in the file, is it expected?

atomGit commented 2 years ago

REPLAYGAIN_REFERENCE_LOUDNESS=-18.00 LUFS is in the metadata - i'm seeing it both when i look at the file in a text and hex editor (kate and okteta respectively)

JeromeMartinez commented 2 years ago

I see REPLAYGAIN_REFERENCE_LOUDNESS (-18) but I don't see 14.17. But I understand now, "Loudness" = "REPLAYGAIN_REFERENCE_LOUDNESS" - "REPLAYGAIN_TRACK_GAIN". If I understand correctly, it makes more sense to display "Loudness" than "REPLAYGAIN_REFERENCE_LOUDNESS" value.

atomGit commented 2 years ago

oh, yes, you're right - i was looking for the string, not the value

i don't completely understand all of this myself - i think you might understand it better and hopefully you have enough to work with