Help - Search - Members - Calendar
Full Version: how to fix a LAME header gone bad
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
timcupery
Hey all, I've been in the habit of running newly encoded mp3 files through mp3trim afterwards, to delete silent frames that get added to the end of the file upon encoding. I've especially done this for live albums where gaplessness matters. However, this caused an unforseen problem, which I've only just realized. Mp3trim deletes or resets the enc_delay and enc_padding information in the LAME header. So now, instead of having enc_delay at 576, it's equal to 0 (when I view file info using foobar). enc_padding is automatically reset from whatever it was - for example, 1120 - to 52.
The upshot of all this is that when I use foobar to decode the files I've run through mp3trim, I now have 576 samples of silence at the beginning of each file, and a fair bit at the end. Since I decode using dither, I can't really use wavegain to remove the silence from the wav files.

What I'm wondering: is there any way to edit the enc_delay and enc_padding values in the LAME tag? I can't find a way to do this in foobar, which would be the program I'd most expect to have such capacity. At least, I'd like to be able to run some sort of batch to set all the mp3 files (at least from live albums and albums where one song fades into the next) that I've encoded with LAME 3.9X to have an enc_delay of 576 instead of 0. Is there any easy way to do this?

WavTrim could easily be programmed with the functionality to remove a given number of samples from the begining of a file, instead of seeking silence and deleting samples on that basis. But it doesn't have that functionality as things stand.

Thanks much for anyone able to help with this. And for the record, I'm no longer using mp3trim on files newly encoded with LAME.

[edit: corrected spelling of wavtrim - it's not wavetrim]
ssamadhi97
QUOTE (timcupery @ Dec 19 2004, 05:22 AM)
What I'm wondering: is there any way to edit the enc_delay and enc_padding values in the LAME tag? I can't find a way to do this in foobar, which would be the program I'd most expect to have such capacity.
*

right-click on single mp3 file, Fix MP3 header...

explanation/discussion thread

no batch mode for you btw.

oh and personally I'd suggest you to simply rerip that material, maybe even encode to a format with better support for gapless playback..
dev0
QUOTE (ssamadhi97 @ Dec 19 2004, 07:24 AM)
oh and personally I'd suggest you to simply rerip that material, maybe even encode to a format with better support for gapless playback..
*

LAME is perfectly gapless, if you don't fuck up the files using crappy tools like MP3Trim.
Why even use it in the first place?
QUOTE
I've been in the habit of running newly encoded mp3 files through mp3trim afterwards, to delete silent frames that get added to the end of the file upon encoding.

That is complete nonsense. Using a proper decoder you'll get a decoded file of the exact same length as the input file.
timcupery
The reason I'd been using mp3trim was that it does remove the 1 or sometimes 2 silent frames left at the end of an encode in LAME (yes, that's right) that show up in Winamp playback. I realize that foobar's decoder reads the LAME header, and then only recently realized that mp3trim junked the enc_delay and enc_padding info, and have therefore stopped using it. But it makes sense for a winamp user, b/c winamp doesn't read the enc_padding and enc_delay info, and running files through mp3trim does remove silence that winamp's decoder plays back, though foobar's would skip it. That is, winamp isn't a "proper decoder" in dev0's terms.

Thanks for the fix info. At least I can fix the enc_delay and bump it back to 576 on all the files where gapless playback matters.

I suspect there's no easy way to sense number of silent samples at end of an mp3 track, in foobar if it'd be anywhere.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.