Since it appears Windows XP requires a TLEN id3v2 field to be correctly set in order to display VBR bitrates and seek properly, I was wondering how to calculate it. According to the id3.org website it should contain track length in miliseconds, but how do i calculate this accurately using the information in the XING header?
getID3()
Feb 15 2004, 22:59
For reference, this discussion started
hereCODE
$average_frame_length = $xing_VBR_bytes / $xing_VBR_frames;
if ($thisfile_mpeg_audio['layer'] == '1') {
$bitrate = ($average_frame_length / 4) * $sample_rate * (2 / $channels) / 12;
} else {
$bitrate = $average_frame_length * $sample_rate * (2 / $channels) / 144;
}
$playtime_seconds = ($filesize * 8) / $bitrate;
$TLEN = round($playtime_seconds * 1000);
it was offtopic in the other thread so i thought i'd move this discussion here...
Could someone with some coding experience perhaps make a patch to LAME for calulating and including a TLEN tag? (with a switch of course, not everyone likes id3v2). Even if you don't use WMP, getting the Windows shell to properly display bitrates would be a nice feature for LAME to have, IMO, and would lend further support to the idea that VBR is just as well supported by software as CBR.
Hmm, you know what? I just hex-edited a TLEN field into one of my files, and while the track time is a little more accurate, the bitrate field is still totally wrong (reports 400-something kbps). So you know what? Forget it. Windows just plain doesn't know what the hell it's doing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.