IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

discussion of fix mp3 header plugin
Xenion
post Jul 26 2003, 18:14
Post #1





Group: Members
Posts: 1041
Joined: 23-May 02
From: DE
Member No.: 2107



what does it exactly do?
should i use it for all my lame encoded files with the setting 576 (encoder delay), 0 (padding)
is it safe to use?
is it recomended to use?
will other players have problems with the "fixed" mp3 headers ?
what is padding? does this have something to do tags ? i only use ape2 tags if this helps

This post has been edited by Xenion: Jul 26 2003, 18:17
Go to the top of the page
+Quote Post
2 Pages V   1 2 >  
Start new topic
Replies (1 - 24)
Peter
post Jul 26 2003, 18:44
Post #2


foobar2000 developer


Group: Admin
Posts: 3275
Joined: 30-September 01
Member No.: 84



QUOTE
what does it exactly do?
It's yet another "vbrfix"-style tool, but with option to edit gapless playback values (probably also faster / more reliable than other "vbrfix" programs from what I've heard).
QUOTE
should i use it for all my lame encoded files with the setting 576 (encoder delay), 0 (padding)
Files encoded with recent LAME should have correct headers with gapless playback info already most of the time (but they apparently don't have if encoded with certain frontends), easy way to check: reported sample count (in file info box) should be a multiply of 588 (cd sector size); reload info from file before checking so you can be sure that reported length you get hasn't been read by old version of mp3 input that didn't support gapless playback.
You can also use this feature on files that have been encoded with different encoders than LAME (they may need different encoder delay though).
QUOTE
is it safe to use?
I think it's safe (I haven't seen any files being damaged by it so far; it even preserves all sorts of tags); hasn't been tested too much though.
Use it only where you need to - eg. for fixing reported length of some weird files (also on CBR files), or for making non-gapless MP3s play gaplessly.
QUOTE
will other players have problems with the "fixed" mp3 headers ?
No, these headers follow LAME header spec from Gabriel's page (also compatible with Xing headers for VBR files), all files encoded with semi-recent LAME have similar headers already; also, those headers are valid MP3 frames (unlike all other tags). If you use a player unaware of them (if one still exists), header will simply produce a silent frame at the beginning of file.
As far as I'm aware of, no other player uses gapless playback info from those headers at the monent.
QUOTE
what is padding? does this have something to do tags ? i only use ape2 tags if this helps
Padding represents amount of null samples (silence) added at the end of file to complete last MP3 frame. Header fix doesn't let you edit padding directly; instead you can enter desired length (in samples) of entire file (which is more useful this way).

There are two ways to get correct length of MP3 file:
a) bruteforce method - run fix on entire album (sorry, it needs per-file settings so it can't be used on multiselection) with proper delay and no padding, then run it again on each file, round reported length in samples down to nearest multiply of 588, listen to the file; if still produces gap - keep subtracting 588 from sample count until you find value that sounds "right".
b) find correct cuesheet for that album (hint: try this site) and extract length values from it - either by substituting referenced file with something and loading the cue in fb2k, or by opening the cue in notepad and calculating lengths from index positions (cue time format: hh:mm:ss:ff, where ff is in 1/75-second frames; one frame has 588 samples).
Note that either method doesn't let you find correct length of last track in album, but that's rather unimportant.
I've fixed 2 albums using the bruteforce method, then found cues and values I "guessed" turned out to be 100% accurate.

[edit] i'll start killing people next time i see "B)" emoticon popping out of nowhere in my text
Go to the top of the page
+Quote Post
Xenion
post Jul 26 2003, 18:56
Post #3





Group: Members
Posts: 1041
Joined: 23-May 02
From: DE
Member No.: 2107



thanks alot for your anwser. makes things alot clearer and easier to understand for me and maybe some others too!
Go to the top of the page
+Quote Post
Peter
post Jul 26 2003, 19:00
Post #4


foobar2000 developer


Group: Admin
Posts: 3275
Joined: 30-September 01
Member No.: 84



I was planning to write such tutorial anyway (to put it in the FAQ perhaps). This headerfix is just too useful.
Go to the top of the page
+Quote Post
Wizard
post Jul 26 2003, 19:18
Post #5





Group: Members
Posts: 346
Joined: 30-September 01
Member No.: 102



QUOTE (zZzZzZz @ Jul 26 2003, 08:44 PM)
Files encoded with recent LAME should have correct headers with gapless playback info already most of the time (but they apparently don't have if encoded with certain frontends), easy way to check: reported sample count (in file info box) should be a multiply of 588 (cd sector size); reload info from file before checking so you can be sure that reported length you get hasn't been read by old version of mp3 input that didn't support gapless playback.

I think it would be useful if we could see in the file info box a confirmation under the number of samples that it is a multiply of 588 or not, so we won't have to do any calculations.
Go to the top of the page
+Quote Post
Peter
post Jul 26 2003, 19:21
Post #6


foobar2000 developer


Group: Admin
Posts: 3275
Joined: 30-September 01
Member No.: 84



QUOTE (Wizard @ Jul 26 2003, 09:18 PM)
QUOTE (zZzZzZz @ Jul 26 2003, 08:44 PM)
Files encoded with recent LAME should have correct headers with gapless playback info already most of the time (but they apparently don't have if encoded with certain frontends), easy way to check: reported sample count (in file info box) should be a multiply of 588 (cd sector size); reload info from file before checking so you can be sure that reported length you get hasn't been read by old version of mp3 input that didn't support gapless playback.

I think it would be useful if we could see in the file info box a confirmation under the number of samples that it is a multiply of 588 or not, so we won't have to do any calculations.

Copy sample count, winkey+R, calc.exe, paste sample count, divide by 588, see if result is an integer.
Simple enough ?
Go to the top of the page
+Quote Post
Wizard
post Jul 26 2003, 19:58
Post #7





Group: Members
Posts: 346
Joined: 30-September 01
Member No.: 102



Can't get any simpler than that tongue.gif ok man, no big deal smile.gif I only asked for it just for convenience.
Go to the top of the page
+Quote Post
ak
post Jul 26 2003, 21:05
Post #8


Musepack Developer


Group: Members
Posts: 359
Joined: 17-October 01
Member No.: 309



QUOTE (zZzZzZz @ Jul 26 2003, 07:44 PM)
a) bruteforce method - run fix on entire album (sorry, it needs per-file settings so it can't be used on multiselection) with proper delay and no padding, then run it again on each file, round reported length in samples down to nearest multiply of 588

Isn't it up to nearest multiply, so e.g 13234223 -> 13234704?
I think rounding down should be used when no encoder delay yet specified.

In other words I can do either:

- first put encoder delay with padding set to 0, then round up to nearest sector
- or put both encoder delay and amount of samples rounded down (or get lenghts from cue, but on couple of albums I tried those values mach) (?)

...

Hmm, although cue might provide wrong values, if file has stream errors, it seems.
Go to the top of the page
+Quote Post
Peter
post Jul 26 2003, 21:27
Post #9


foobar2000 developer


Group: Admin
Posts: 3275
Joined: 30-September 01
Member No.: 84



It is rounding down (rounding up would mean adding extra null samples, while we want to do the opposite).
Anyway, rounding down to nearest multiply to 588 isn't usually enough, you have to go down by one or two 588-sample sectors to get correct value (there's another value - decoder delay: 529 samples used internally, but it's not "user-visible" anywhere, except it affects reported length).
Go to the top of the page
+Quote Post
treech
post Jul 27 2003, 00:23
Post #10





Group: Members
Posts: 208
Joined: 28-May 02
From: Helsingborg
Member No.: 2147



where can i dl this plugin ? any link ?
Go to the top of the page
+Quote Post
Xenion
post Jul 27 2003, 00:24
Post #11





Group: Members
Posts: 1041
Joined: 23-May 02
From: DE
Member No.: 2107



QUOTE (treech @ Jul 27 2003, 12:23 AM)
where can i dl this plugin ? any link ?

included in the latest betas of 0.7
just click with the right mousebutton on any mp3 file.
edit: if you still don't see it make sure that you have this button enabled under "context menü items"

This post has been edited by Xenion: Jul 27 2003, 00:25
Go to the top of the page
+Quote Post
treech
post Jul 27 2003, 00:30
Post #12





Group: Members
Posts: 208
Joined: 28-May 02
From: Helsingborg
Member No.: 2147



Latest beta(s), ok thanks biggrin.gif
Go to the top of the page
+Quote Post
Xenion
post Jul 27 2003, 00:31
Post #13





Group: Members
Posts: 1041
Joined: 23-May 02
From: DE
Member No.: 2107



QUOTE (treech @ Jul 27 2003, 12:30 AM)
Latest beta(s), ok thanks biggrin.gif

hm whats the plural of beta?
i meant that it's not only included in 27 but maybe in 26 and 25 too, anthough i'm not sure unsure.gif

This post has been edited by Xenion: Jul 27 2003, 00:33
Go to the top of the page
+Quote Post
mai9
post Sep 13 2003, 23:03
Post #14





Group: Members
Posts: 100
Joined: 17-March 03
Member No.: 5542



QUOTE (zZzZzZz @ Jul 26 2003, 10:21 AM)
QUOTE (Wizard @ Jul 26 2003, 09:18 PM)

I think it would be useful if we could see in the file info box a confirmation under the number of samples that it is a multiply of 588 or not, so we won't have to do any calculations.

Copy sample count, winkey+R, calc.exe, paste sample count, divide by 588, see if result is an integer.
Simple enough ?

I understand that this is simple enough, but imagine the zillion users foobar doing maths with the thousand mp3 they have. huh.gif

I guess that half of that zillion users would prefer that division to be automated inside foobar. unsure.gif
Go to the top of the page
+Quote Post
BigRedMachineSla...
post Sep 21 2003, 15:25
Post #15





Group: Members
Posts: 22
Joined: 9-July 02
From: QLD
Member No.: 2530



While we're on the topic of gapless play back and the "fix mp3 header" function in foobar, I thought I would share my experience in the hope it helps other people out.

I just tried creating some mp3's from two adjacent tracks on a live album I've got. I used EACv0.95prebeta3, encoding with LAME 3.92 set to --alt-preset extreme. I had "add id3 tag" checked and also "use id3 v1.1 instead of id3 v1.0". I then played the files back in foobar 0.7 rc16. They played WITH a gap between them. Ok, so I calculated the proper file length in samples and typed it in. When I applied them the console screen popped up saying the padding was too big (or something like that). It then changed the last three digits of the "desired length of track" samples to 888. If I then changed it to 0, it reset to the original track length (in samples).

I then proceded to muck around in EAC and found out that by UNCHECKING "use id3 v1.1 instead of id3 v1.0" that the new files played back with NO gap. Hooray, we all can now have gapless mp3 playback. But I guess if you use APE or other such tags there might not be problems either.

In summary, for those who want gapless playback of MP3's you need to use id3 tags V1.0 (i.e. with no track number). I don't use APE tags or anything else so I don't know if they will work or not. To correct a file with id3 v1.1 or later tags, I guess you would need to remove the tags and replace them with ID3V1.0 tags.

Hopefully this is of some help to people trying to get gapless playback.
Go to the top of the page
+Quote Post
XXX
post Oct 5 2003, 05:32
Post #16





Group: Banned
Posts: 32
Joined: 4-August 03
Member No.: 8154



A sector on an audio CD is 2352 bytes, not 588. From where does this 588 come? Samples? Oh, do mono CD tracks have 588 samples per sector?

This post has been edited by XXX: Oct 5 2003, 05:36
Go to the top of the page
+Quote Post
kjoonlee
post Oct 5 2003, 05:59
Post #17





Group: Members
Posts: 2526
Joined: 25-July 02
From: South Korea
Member No.: 2782



Yes, it means samples. smile.gif 2352 bytes mean 18816 bits. For stereo, 588 16bit samples, in stereo, mean 588 x 16 x 2 == 18816 bits.

So a sector on a stereo CD can be said to be either 2352 bytes of PCM, or 588 16bit stereo samples.


--------------------
http://blacksun.ivyro.net/vorbis/vorbisfaq.htm
Go to the top of the page
+Quote Post
kjoonlee
post Oct 5 2003, 06:03
Post #18





Group: Members
Posts: 2526
Joined: 25-July 02
From: South Korea
Member No.: 2782



I have a question about the fix mp3 header plugin.

What do I do if I want to fix the vbr header, but want to leave the encoder delay/song length values etc. untouched? Is that possible with foobar2000's plugin?

This post has been edited by kjoonlee: Oct 5 2003, 06:04


--------------------
http://blacksun.ivyro.net/vorbis/vorbisfaq.htm
Go to the top of the page
+Quote Post
AtaqueEG
post Oct 5 2003, 06:08
Post #19





Group: Members (Donating)
Posts: 1336
Joined: 18-November 01
From: Celaya, Guanajuato
Member No.: 478



QUOTE (BigRedMachineSlash @ Sep 21 2003, 09:25 AM)
In summary, for those who want gapless playback of MP3's you need to use id3 tags V1.0 (i.e. with no track number).  I don't use APE tags or anything else so I don't know if they will work or not.  To correct a file with id3 v1.1 or later tags, I guess you would need to remove the tags and replace them with ID3V1.0 tags.

This is not true.
I use tracknumbers all the time in ID3 tags (therefore, I use ID3 1.1).
Gapless playback here (foobar 0.7.1 beta3).
Maybe you screwed up in some other EAC settings.
Or maybe I am just lucky (very small chance)


--------------------
I'm the one in the picture, sitting on a giant cabbage in Mexico, circa 1978.
Reseņas de Rock en Espaņol: www.estadogeneral.com
Go to the top of the page
+Quote Post
BigRedMachineSla...
post Oct 21 2003, 14:43
Post #20





Group: Members
Posts: 22
Joined: 9-July 02
From: QLD
Member No.: 2530



I'm just stating what I found in my short tests with foobar2000 v0.7.0. I'm pretty sure I didn't screw anything up in EAC. I used EAC v0.95pb3. Maybe I'll re-test when I have some more spare time. Maybe EAC has bug or foobar2000 v0.7.1 has fixed a problem or maybe I did stuff up somewhere? I'm not sure. Someone else can test if they want to confirm.
Go to the top of the page
+Quote Post
TempestuousTosh
post Oct 21 2003, 18:27
Post #21





Group: Members
Posts: 23
Joined: 17-February 02
From: London
Member No.: 1338



hey

I've finally got to grips with this, and can now fix ANY of my mp3's, not just the LAME ones, with the limitation that they all have to have the same encoder delay (i.e. they were all encoded at the same time).

Thanks Peter...

I'm assuming that this information is updating the MP3 header, and therefore my work can't be undone by another program.

If anyone wants my tried and tested method, reply to this, and I'll knock up some instructions and a whizzy spreadsheet.

This post has been edited by TempestuousTosh: Oct 21 2003, 18:31


--------------------
--Tosh
Go to the top of the page
+Quote Post
AtaqueEG
post Oct 21 2003, 19:29
Post #22





Group: Members (Donating)
Posts: 1336
Joined: 18-November 01
From: Celaya, Guanajuato
Member No.: 478



QUOTE (TempestuousTosh @ Oct 21 2003, 12:27 PM)
If anyone wants my tried and tested method, reply to this, and I'll knock up some instructions and a whizzy spreadsheet.

Please, by all means smile.gif


--------------------
I'm the one in the picture, sitting on a giant cabbage in Mexico, circa 1978.
Reseņas de Rock en Espaņol: www.estadogeneral.com
Go to the top of the page
+Quote Post
TempestuousTosh
post Oct 27 2003, 02:53
Post #23





Group: Members
Posts: 23
Joined: 17-February 02
From: London
Member No.: 1338



sorry, haven't been around for a few days

I'll post something soon


--------------------
--Tosh
Go to the top of the page
+Quote Post
AtaqueEG
post Oct 27 2003, 05:22
Post #24





Group: Members (Donating)
Posts: 1336
Joined: 18-November 01
From: Celaya, Guanajuato
Member No.: 478



QUOTE (TempestuousTosh @ Oct 26 2003, 08:53 PM)
sorry, haven't been around for a few days

I'll post something soon

Is that a promise? tongue.gif

No, really, I hope you can post a little tutorial.
It would be very helpful.


--------------------
I'm the one in the picture, sitting on a giant cabbage in Mexico, circa 1978.
Reseņas de Rock en Espaņol: www.estadogeneral.com
Go to the top of the page
+Quote Post
TempestuousTosh
post Oct 27 2003, 06:55
Post #25





Group: Members
Posts: 23
Joined: 17-February 02
From: London
Member No.: 1338



couldn't get any sleep, so here you go.

Firstly, this method only works for those CDs which have been ripped using an accurate ripper, and compressed with the same encoder.

Before you start.
You will need:

Foobar
Case's Gap Killer

In your DSP list, put the Gap Killer at the top of your DSPs, and load your playlist with the mp3's you want to make gapless.

Play your CD, and skip to near the end of each track. Listen to the transition, and if it isn't smooth - i.e. sounds jumpy or there are samples missing, then your underlying mp3's aren't accurate and this method can't help you.

If your mp3s are smooth (with Case's Gap Killer) you can continue.

Fixing the encoder delay.

Show the foobar Console. (components/show console.)

Play the first track and move the slider almost to the end, so that it flips to the next track. In the console you'll see how many samples the gap killer removed as below:

CODE
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\201.mp3" (0)
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\202.mp3" (0)
INFO (foo_dsp_nogaps) : 887 samples removed (from end)
INFO (foo_dsp_nogaps) : 576 samples removed (from beginning)


This shows us that it removed 887 samples from the end of track 1, and 576 from the beginning of track 2. At the moment, we're only concerned with the samples removed from the beginning. Quickly skip to the end of all your tracks (in order) and make a quick table as below.

CODE
Track   samples removed
       from beginning

1       576
2       576
3       578
4       576
5       575
6       578
7       254
8       577
9       577
10      576
11      576
12      578 (end of cd)


From this list, we can deduce that the most likely number of samples to remove from the beginning of each track is 576 - i.e. the encoder delay for each track is 576 samples.

Note, in my example above, track 7 hasn't got the correct encoder delay, and when playing this track there is a audible skip with missing samples (with gap killer). This track transition can't be fixed.

This is probably a LAME encoded album, but since foobar didn't detect the mp3 as being of accurate length, we're going to have to fix the mp3 headers. This method also works for Fhg and Xing encoded mp3s, as long as the delays are all close to each other.

Right click on each file in turn, and choose Fix MP3 header... Enter the same encoder delay for each one, and leave the desired length BLANK.

You've now fixed the encoder delay for all your mp3s.

Play the first track again, and move the slider near the end - check the console, you should now see entries like this:

CODE
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\201.mp3" (0)
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\202.mp3" (0)
INFO (foo_dsp_nogaps) : 887 samples removed (from end)
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\203.mp3" (0)
INFO (foo_dsp_nogaps) : 1200 samples removed (from end)
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\204.mp3" (0)
INFO (foo_dsp_nogaps) : 1078 samples removed (from end)
INFO (CORE) : opening file for playback :
INFO (CORE) : location: "file://D:\_mp3\VA\Gatecrasher Resident Transmission 02 CD1\205.mp3" (0)
INFO (foo_dsp_nogaps) : 1078 samples removed (from end)

Note that Gap Killer is no longer removing samples from the beginning of the tracks.

Fixing the track length in samples.

Now you'll need my spreadsheet. Start the spreadsheet next to Foobar, so you can see both of them at the same time. The only value you're going to enter is the original length in BLUE.

Play the first track (showing the console), and flip to the next track - your output should say as follows:

INFO (foo_dsp_nogaps) : 887 samples removed (from end)

Right click the first track (you don't need to stop foobar, since it's now playing the second track), and choose Fix MP3 Header... Copy the length in samples from the dialog box, and paste into the spreadsheet. You can ALT-TAB between Excel and Foobar, leaving the cursors in the same place.

In the spreadsheet, you're looking for the track length in samples (RED values), which is closest to the output of Gap Killer. Gap Killer removed 887 samples, and the corresponding track length is 13732152 (in my example). ALT-TAB back to foobar, and edit the desired length. Hint, usually only the last four digits change.

Press OK to save your new length, and double click the first track again. Skip to the end, and your mp3s should now be gapless!

Repeat this for the rest of your mp3s, and your work is done!

You can now remove Gap Killer from the active DSPs and check your work.

Troubleshooting

If this doesn't work for you, your mp3s probably don't sound right with gap killer anyway, therefore you're not going to able to fix your mp3s. Sorry. Also, if you've got an album collected from various sources, and they don't all have the same encoder delay, you can try setting them individually, but whenever I've done this, I've run into problems.

Tips for Writing CDs with Nero.

Some of my albums only have a few gapless tracks between some songs - don't waste your time fixing all of the tracks, only do those that are needed.

My reason for doing this, was so that I could write gapless CDs for the Car. If you're doing the same, and you're using Nero, I suggest you do the following.

When you're outputting your mp3s to WAVs using the Diskwriter, use the output file name formatting as %artist% - %title%.

To create an Audio CD in Nero, sort your directory by date/time, and drag your WAVs into the compilation. Your Artist and Track Title fields will be properly formatted for CD-TEXT. You just need to highlight tracks 2-end, double click and set track gap to 0.

Press Burn, set the Artist, Album Name, Speed and Go.

ps. where can I upload the spreadsheet?

This post has been edited by TempestuousTosh: Oct 27 2003, 07:03


--------------------
--Tosh
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th July 2014 - 13:07