PDA

View Full Version : How to detect Replaygain tag?


liveman
2005-12-01, 09:45 AM
I know it's a dumb question but I'd like to know how can I detect that my FLAC files have replaygain tag in it? :hmm:

I've downloaded a set that I've been told was replaygain tagged but I didn't get the info when, for example, I put the file into winamp and ask for "file info" or into foobar when I click on a specific track for "show info file (special)" or "properties".

I made a test encoding a wav file with "replaygain" option checked on Flac Frontend and this time I have replaygain info for the specific flac file on foobar - "show info file (special)"

I've re-encoded the original replaygain flac to flac and indeed there's a difference: I have same fingerprints / shntool md5 signature / bitcompare results as audio data is indentical but mkwACT md5 signature is different for the two tracks due to the hidden tag...

I guess there's no need for me to rencode the flac for fixing it because when I decode the flac to wav the replaygain info is gone, am I right?

Five
2005-12-02, 11:05 AM
there was a discussion about this a month or two back... I don't believe there's any way to view/edit realplaygain tags, they can be added at the time of encoding and that's about it (for the time being). If anybody knows how to view/edit them, I'd love to learn.

the "mkwACT md5 signature" is a simple wholefile md5 hash which can also be generated by many other progs (such as md5summer). This is a "dumb" sum because it is based on the entire file, so when you run one on a FLAC it calculates based on the compressed audio together with its header. So the little bit of information contained in the header for realplaygain (probably 1k) is what's throwing off the verification, whereas with ffp & st5 the hash is generated from the decompressed audio. ffp & st5 are subtlely different but the checksums aside from formatting will be identical for any properly encoded FLAC set. The advantage of st5 over old wholefile md5 is that since it calculates based on the decompressed audio only it will show the same checksums even if you reencode at a different compression setting or even to another lossless format. md5 is sensitive to any change in the compression and/or header and can be useful (as you've found) for detecting changes in the header when all else fails.

hope that makes sense, I'm still on my 1st coffee...

DoIFeelLucky
2005-12-02, 12:47 PM
foobar2000 allows you to scan files for ReplayGain (album- or track-based), allows you to edit ReplayGain gain and peak values manually (although that's not usually a good idea, especially if you're increasing the values, as it can lead to clipping), and lets you remove all ReplayGain info from files.

Now I just did a test, encoding the same file from WAV to FLAC, using FLAC Frontent 1.7.1. Both files had a padding value of 4096. The first was encoded without the ReplayGain option, and the second was encoded to a different folder using ReplayGain. I copied the ReplayGained file to a third folder. Then, I opened this copy in foobar2000, right-clicked on it, selected Replaygain > Remove replaygain info from files.

File sizes (according to foobar2000's file info dialogue):
FLAC: 25,047,172 Bytes
FLAC w/ReplayGain: 25,047,320 Bytes
FLAC w/ReplayGain info removed: 25,047,320 Bytes

Even after I removed the ReplayGain info from the FLAC file, the tags disappeared but the less-than 150 Bytes taken up by the tags was not removed from the file. Since all three files have different wholefile md5 hashes, I'm assuming that the tiny portion of the file's header that contained the ReplayGain tags has been changed to null data.

BUT WAIT!

Since all the FLAC files that I'd created had 4096 bits of padding (FLAC Frontend's default, since I saw no option to specify padding values), I figured, what if I took my original FLAC file (the one I encoded without using ReplayGain), and used foobar2000's ReplayGain scanner to apply ReplayGain info to it? [To do this, right-click on the file or group of files that you want to ReplayGain, and say Replaygain > Scan per-file track gain or Scan selection as album. The latter is pretty much the only viable option for people dealing with concerts, anyway.]

I tried it, and lo and behold, the file was the same size as the original, even after the ReplayGain tags were added (25,047,172 Bytes). Obviously, foobar2000 wrote the ReplayGain tags into the file's padding (which is what the padding is there for, anyway). Checking that file against the md5 hash that I'd calculated earlier obviously produced a different sum and an error message. I then took this file, and using the aforementioned method, removed the ReplayGain info from the file. I checked the file info: the tags were gone and the file size was still 25,047,172 Bytes. I then checked the file against its original md5 hash. This time, it verified OK!

So, long story short, if you want to add ReplayGain info (or any other tags, such as title, artist, album, tracknumber, etc.) to a FLAC file and be able to later remove that info and have it check out OK against the original wholefile md5, use foobar2000's ReplayGain tool to scan and add the ReplayGain tags. This won't work if the file doesn't contain padding to facilitate the writing of tags, but FLAC encoders (such as the FLAC Frontend and foobar2000's FLAC encoder (http://www.saunalahti.fi/cse/foobar2000/foo_flaccer.zip) ) add 4096 bits of padding by default, so unless the person encoding it messed around with FLAC's options for some insane reason, it should work fine.

Five
2005-12-02, 02:55 PM
wow that's some detailed information thanks for that

wholefile md5s shouldn't be used with audio shows any longer, .ffp and/or .st5 are pretty much all I ever see anymore (as it should be). with ffp/st5 you can change the header all day (and even the format) so it is preferred.

Beleaguered
2005-12-05, 12:32 PM
Nobody likes the command line....

To view all tags (including replaygain):
metaflac --list --block-type=VORBIS_COMMENT track.flac

To add replaygain tags:
metaflac --add-replay-gain *.flac(Note, under Windows you need to replace *.flac with the complete list of all tracks in the album: track01.flac track02.flac track03.flac etc.)

For other commands:
metaflac --help

metaflac should be included in the the standard flac distribution.

jcrab66
2005-12-05, 09:50 PM
wow that's some detailed information thanks for that

wholefile md5s shouldn't be used with audio shows any longer, .ffp and/or .st5 are pretty much all I ever see anymore (as it should be). with ffp/st5 you can change the header all day (and even the format) so it is preferred.


what can one use to generate an st5?

Beleaguered
2005-12-06, 11:06 AM
what can one use to generate an st5?
Shntool (http://www.etree.org/shnutils/shntool/): shntool md5 *.flac
or
Trader's Little Helper (http://www.thetradersden.org/forums/showthread.php?t=3904)