Help: I need a proper method to detect 99% of all mp3 files
Allan Sandfeld Jensen
kde at carewolf.com
Wed Jul 14 17:09:34 BST 2004
On Wednesday 14 July 2004 17:54, you wrote:
> On Sunday 11 July 2004 16:47, Allan Sandfeld Jensen wrote:
> > On Thursday 08 July 2004 14:34, Matthias Welwarsky wrote:
> > > On Tuesday 06 July 2004 14:52, Scott Wheeler wrote:
> > > > On Tuesday 06 July 2004 12:49, Matthias Welwarsky wrote:
> > > > > Well, the proper method is to parse the bitstream and see if it is
> > > > > compliant to the standard. This is both quick and reliable, and
> > > > > works with and without tags.
> > > >
> > > > Well, except for the quick part. ;-)
> > > >
> > > > Operations like this are bound by disk speed, not code complexity or
> > > > CPU time.
> > >
> > > Hm? mp3 frames are typically around 400 byte long, and decoding a few
> > > of them is probably much less a hassle than parsing a tag. So the "disk
> > > speed" not an issue, not even over network or USB.
> > MP3-files are sometimes prepended with upto 14kbytes of crap that needs
> > to be searched for synchronizations frames. If you dont skip ID3v2
> > frames, this will be quite common when reading iTunes mp3s with embedded
> > pictures.
> Yes, but you would not feed the ID3v2 tag into the decoder anyway, would
> you? And risk distorted audio because the decoder chokes on the tag data.
> So you need code to skip the ID3v2 tag.
ID3v2 is designed to be automatically skipped by MP3 decoders, so it is
perfectably safe to to feed to the decoder.
> And, if you have an ID3v2 tag, there's not much sense in decoding the mp3
> bitstream to find out whether it is an mp3 or not :)
There are other formats that use ID3v2 tags, and even more that stupid
applications tags with them anyway.
More information about the kde-multimedia