[ID3 Dev] First byte of the first frame: the inevitable byte (revised)

Andy Kernahan andrew.kernahan at btinternet.com
Wed Jan 25 12:07:27 PST 2006


The sync-signal has a byte pattern of 0xFFE0. Scanning the file stream for 
this pattern will reveal the position of the first frame within the mp3 
file.

Andy.
  ----- Original Message ----- 
  From: Mitchell S. Honnert
  To: id3v2 at id3.org
  Sent: Wednesday, January 25, 2006 7:35 PM
  Subject: RE: [ID3 Dev] First byte of the first frame: the inevitable byte 
(revised)


  If all you want to do is find the first audio frame, you don't necessarily 
need to know the ID3v2 tag length.  (If you do need the length, it's clearly 
spelled out in the spec.)  Do a search on MPEG header and you'll find the 
byte pattern which identifies the start of an audio frame.  One location for 
this information is at http://www.mp3-tech.org/ in the Programmer's Corner 
section.  (In writing my .NET tag editor library, I decided to add support 
for MPEG data like bit rate and frequency, and this is the page I used as a 
reference.)



  Mitchell S. Honnert

  www.UltraID3Lib.com






------------------------------------------------------------------------------

  From: Silas Pradetto [mailto:silas at sonoroussound.com]
  Sent: Wednesday, January 25, 2006 2:22 PM
  To: id3v2 at id3.org
  Subject: [ID3 Dev] First byte of the first frame: the inevitable byte 
(revised)



        thanks, the files encoded by different encoders I would consider to 
be different, i only want to detect files that i may have downloaded twice 
and are in different dirs, and someone may have changed the tag on one not 
the other, but the file is the same otherwise. thanks for the suggestion on 
the already-done dup remover, as i have no real time for writing this stuff 
anymore, the other question is how to find the length of the ID3v2 tag???

        thanks again,

        silas


       If you really want to reinvent the wheel you can -- you have to 
determine how long the ID3v2 tag is, skip that, then read the rest of the 
file (excepting the last 256 bytes if it has an ID3V1 tag). How you do this 
depends entirely on the library (if any) you use. Note that if all you do is 
a byte-by-byte comparison then you still won't detect dupes if the files 
were encoded by different encoders, or at different bitrates, or various 
other issues.

        If you don't want to reinvent the wheel, then go take a look at 
musicbrainz.org -- they've already done this. And taken care of the various 
issues I listed above.

        On 1/25/06, Silas Pradetto <silas at sonoroussound.com> wrote:

        I recently became added to this system of emails, and I am trying to 
write a program to find duplicates in MP3's. I wish to only take into 
consideration the actual song data, not bytes of any tags. Therefore, how do 
I find the first byte in the file of actual song data, ie the first byte of 
the first frame? I want to be able to detect duplicates that have different 
tags but are the exact same audio information. Also, to make the program 
faster, I would like to know where to find certain info such as bitrate, 
length in seconds, etc, so when I am scanning my 100000 song library I don't 
have to check bytes if the songs are obviously dissimilar. Thanks very much. 
Oh, and I mostly do VB 6, though I do know some C++, so if you are going to 
talk about file I/O stuff please refer to VB if you can.

        Silas
        --------------------------------------------------------------------- 
To unsubscribe, e-mail: id3v2-unsubscribe at id3.org For additional commands, 
e-mail: id3v2-help at id3.org






  --------------------------------------------------------------------- To 
unsubscribe, e-mail: id3v2-unsubscribe at id3.org For additional commands, 
e-mail: id3v2-help at id3.org 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.id3.org/pipermail/id3v2/attachments/20060125/3c0620f1/attachment.html>


More information about the ID3v2 mailing list