FLAC -> MP3, how to migrate ReplayGain? |
![]() ![]() |
FLAC -> MP3, how to migrate ReplayGain? |
Aug 13 2006, 06:42
Post
#1
|
|
![]() Group: Members Posts: 102 Joined: 3-January 06 Member No.: 26831 |
I'm writing a script that will transcode FLAC files to either Ogg Vorbis or MP3. Part of the process involves copying over all tag and ReplayGain data. When converting to Ogg Vorbis this is easy because ReplayGain is implemented as comments in FLAC files; all I have to do is copy the tags and the ReplayGain information is included.
However, I'm not sure how I can copy over the ReplayGain information to an MP3 file. As far as I can tell there are no id3v1 or id3v2.3 tags available for ReplayGain. I know that mp3gain has some kind of support for APEv2 tags, but I'm not really sure how to apply that to an MP3 file. I also considered using mp3gain directly, but I want to transfer the ReplayGain information, not reanalyze and apply new data. I know that you can specify the ReplayGain information mp3gain should apply, but I don't know how to make that work either as the information produced by ReplayGain and mp3gain seems to be different. For example, here's the Track ReplayGain and mp3gain information for the same song that was converted from a FLAC to an MP3: CODE $ vorbiscomment 01-Have\ Yourself\ a\ Merry\ Little\ Christmas.ogg REPLAYGAIN_TRACK_PEAK=0.66180420 REPLAYGAIN_TRACK_GAIN=+1.14 dB $ mp3gain -s c 01-Have\ Yourself\ a\ Merry\ Little\ Christmas.mp3 Recommended "Track" dB change: -0.405000 Recommended "Track" mp3 gain change: 0 Max PCM sample at current gain: 25685.721088 Max mp3 global gain field: 211 Min mp3 global gain field: 128 Any suggestions here? I'm sure I'm not the first person to do something like this, but I haven't had any luck so far searching for the answer. Any ideas would be most appreciated. Thanks. -------------------- http://www.legroom.net/
|
|
|
|
Aug 13 2006, 22:41
Post
#2
|
|
|
Group: Members Posts: 26 Joined: 17-April 06 Member No.: 29678 |
I know that this doesn't answer your question, but you obviously know something that I am having a hard time figuring out. How are you encoding files from a CD and having the replay gain added to the FLAC comments? What program should I use? I am a bit of a newbie in this stuff. Thanks!
|
|
|
|
Aug 13 2006, 23:02
Post
#3
|
|
![]() Group: Members (Donating) Posts: 713 Joined: 8-July 04 From: Sao Paulo Member No.: 15173 |
Beware that replaygain values for lossless and lossy of the same track/album are *not* the same. There are differences that might be significant.
To be on the safe side you should reanalyze the lossy files. -------------------- http://volutabro.blogspot.com
|
|
|
|
Aug 13 2006, 23:56
Post
#4
|
|
![]() Group: Members Posts: 102 Joined: 3-January 06 Member No.: 26831 |
How are you encoding files from a CD and having the replay gain added to the FLAC comments? What program should I use? I am a bit of a newbie in this stuff. Thanks! I just use metaflac, which includes support for ReplayGain. I automate the ripping process using AutoFLAC. Beware that replaygain values for lossless and lossy of the same track/album are *not* the same. There are differences that might be significant. To be on the safe side you should reanalyze the lossy files. Thanks, beto. That's an interesting point that I wasn't aware of. I'll probably add an option to do exactly that. However, if possible I'd still like to provide the option to simply migrate over the replaygain settings as-is, which would greatly speed up the conversion process when we're talking about hundreds of songs. Can anyone else provide some more information on doing that? This post has been edited by nitro322: Aug 13 2006, 23:57 -------------------- http://www.legroom.net/
|
|
|
|
Aug 14 2006, 06:34
Post
#5
|
|
![]() Group: Members Posts: 112 Joined: 9-February 06 From: Edmonton, Alberta Member No.: 27644 |
|
|
|
|
Aug 14 2006, 06:47
Post
#6
|
|
|
Group: Members Posts: 826 Joined: 29-September 04 Member No.: 17374 |
What would be the difference? RG values would be different, for example: 08 - Bon Jovi - Last Cigarette.wav: Track gain -9.51 dB, Track peak 1.000000 08 - Bon Jovi - Last Cigarette_lameV5_vbr-new.mp3: Track gain -9.55 dB, Track peak 1.271805 This post has been edited by Egor: Aug 14 2006, 07:00 |
|
|
|
Aug 14 2006, 15:03
Post
#7
|
|
![]() Group: Members (Donating) Posts: 1302 Joined: 4-March 02 From: Indianapolis, IN Member No.: 1440 |
Yes, I had observed this as well. I always rescan after converting to lossy. It's usually a small change, but I'm anal that way ;-)
-------------------- Wait Master, it might be dangerous... you go first.
|
|
|
|
Aug 16 2006, 00:54
Post
#8
|
|
![]() Group: Members Posts: 102 Joined: 3-January 06 Member No.: 26831 |
So... given the fact that there can be a difference, does anyone know of a way copy ReplayGain setting from one file to another if they just really wanted to? Egor, it looks like you have a way to read ReplayGain settings across multiple file types using a common format. Can that same method be used to apply the ReplayGain settings?
-------------------- http://www.legroom.net/
|
|
|
|
Aug 16 2006, 01:09
Post
#9
|
|
|
Group: Members Posts: 64 Joined: 22-July 05 Member No.: 23461 |
foobar2000 can do that.
|
|
|
|
Aug 25 2006, 06:20
Post
#10
|
|
![]() Group: Members Posts: 102 Joined: 3-January 06 Member No.: 26831 |
Kirby54925, thanks for the reply, but the goal here is to write a script that transcodes FLAC files to a lossy format. I can't exactly use foobar2000 for that.
I did, however, find a solution that works. I'm using a program called getID3() to handle the actual tag management. I posted a similar question on the getID3() forum, and one of the developers responsed with a post detailing the various methods used to apply ReplayGain to MP3 files. Anyone interested in this topic should give it a read: http://www.getid3.org/phpBB2/viewtopic.php?t=605 So, adjusted my script to check for ReplayGain tags in the source file; if found, write the ReplayGain data to the APE tag fields, which directly corrspond to the ReplayGain fields used by FLAC and Ogg Vorbis. id3 info is applied separately to standard id3v1 and id3v2.3 tags, so this shouldn't have any negative effect on players that do not support ReplayGain. In this case I use getID3() to apply the tags, but theoretically you should be able to use any APE tag writer to do the job. Of course, I don't know of any other APE tag writers available under Linux, so like I said, "theoretically." Hope this helps someone else out there. Thanks to those that took the time to respond. -------------------- http://www.legroom.net/
|
|
|
|
Aug 25 2006, 12:58
Post
#11
|
|
![]() Group: Members Posts: 1455 Joined: 22-November 05 From: Jakarta Member No.: 25929 |
What would be the difference? RG values would be different, for example: 08 - Bon Jovi - Last Cigarette.wav: Track gain -9.51 dB, Track peak 1.000000 08 - Bon Jovi - Last Cigarette_lameV5_vbr-new.mp3: Track gain -9.55 dB, Track peak 1.271805 Humans can barely hear a +/- 0.5 dB difference and you're fussing over 0.04 dB? Get real -------------------- Nobody is Perfect.
I am Nobody. http://pandu.poluan.info |
|
|
|
Aug 25 2006, 13:17
Post
#12
|
|
![]() Group: Members Posts: 2519 Joined: 25-July 02 From: South Korea Member No.: 2782 |
Ah, but look at the peaks.
-------------------- http://blacksun.ivyro.net/vorbis/vorbisfaq.htm
|
|
|
|
Aug 25 2006, 13:37
Post
#13
|
|
|
ReplayGain developer Group: Developer Posts: 3203 Joined: 5-November 01 From: North Yorkshire Member No.: 409 |
If you could, you need to copy over the album and track gains (because they should never change significantly), but re-calculate the peaks (which is quicker than re-calculating eveything).
As for the original question... Most people going down this route are encoding for portable players. In this case, ReplayGain tags are useless, and it makes more sense to apply the gain change before encoding. However, I'm glad you got it to work! Cheers, David. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 06:59 |