Comment 8 for bug 63851

Revision history for this message
RAFFI TEA (raffitea) wrote :

Ignore my comment above. Taglib was installed properly.

I did some investigations and wrote a small program to find out why VBR mp3 files are still geting miscalculated.

Keep in mind that TagLib has been compiled with --enable-debug

*Some of my files have invalid headers or invalid sample rates. This must be wrong. Otherwise XMMS or Realplayer would not be able to calculate the songlength. Lines 216 to 231 in mpegheader.cpp are responsible for that. I do not know if a header/frame can have a sample reate of 0.

* To estimate the duration of VBR files, you have to know the average bitrate of the whole file. It often differs a lot from the bitrate of the first frame, because the lowest bitrate available is used for silence in music titles (especially at the beginning). To get this average bitrate, you must go through all the frames in the file and calculate it, by summarizing the bitrates of each frame and dividing it through the number of frames. Because this isn't a good practice (very slow), there exists additional VBR headers within the data section of the first frame (XING header).

* TagLib looks for a XING header in order to calcuate the the song length. Unfortunately a XING header is not mandatory in VBR files. If it is missing a VBR file is treated as a CBR file which is wrong. In other words: If a XING header is found the file is VBR encoded. Otherwise it can be a CBR or a VBR file. To dedect the song length correct for both cases you must go through all the frames in the file and summarize the bitrates.
Lines 206 to 216 in mpegproperties.cpp must be changed

I hope the Taglib Team can fix that ugly bug ASAP.