You are here: Home » Reply

Reply To: Song length detection in vbr mp3s



@grebo wrote:

Okay I had a look at the id3 tags and can’t find anything that looks like the length. I used id3info (part of id3lib) and then tried TagsRevisited on my Windows box. Neither shows any tags the other misses out and neither shows any length tag. I suppose that confirms there is no such tag!

That tag is TLEN. It should be filled (at least!) for vbr mp3 files, where the content length can’t be determined based on bitrate and data length. Not all tagger/encoders do that though.

The Xing encoder, which was the first encoder to support VBR, added a “fake” mp3 frame at the start of the data that held information about the total number of frames in the song, which helps programs like firefly figure out what the song duration is.

The problem you are seeing is that I’ve always read TLEN as a valid tag, but your song doesn’t have a TLEN tag. iTunes reads the Xing data at the start of the data and can therefore calculate the right duration of the song.

Only nightlies currently reads the xing tag. So you can either use brute force to find the number of frames in the song (option 2), or you can upgrade to nightlies (which will read the xing tag, and won’t have to brute force the frame count).

enc_delay and enc_padding are two fields from the “LAME header” enabling gapless playback. The LAME header usually follows directly a Xing/Info tag which both are located in the first MP3 frame

Now it all makes sense. Is this what you mean when you say “xing tags”?

Right (ish). About the xing tag, anyway. The gapless tag is another story.

— Ron