Identifying files before and after renaming - mp3 format finding end of id3v2 tags

Discussion in 'Perl' started by rumex, Jun 17, 2010.

  1. rumex

    rumex New Member

    Joined:
    Jun 17, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi I am a newbie to the mp3 format.
    I want to generate a CRC or SHA1 over the first music data section in an mp3 file so I can identify the file in a database; after both filename, path and internal id3v2 and id3v1 tags have been added, deleted and modified.
    I believe the highlevel layout of an mp3 file looks like:
    |0..n id3v2 tags...|0.n music sections|0..1 id3v1 tag|
    I think the id3v2 tags optionally occupy many sections at the front of the file. I tried a sha1 at the end of the file, avoiding any id3v1 tag, but too many tracks had identical sha1 generated in the last 10,000 bytes of the file. These were tracks from the same album CD.
    I am using perl and wish to programatically identify id3v2 sections and their length to skip over them. For consistency I need to always identify the first music section.
    Has anyone done this or suggest a better way to do this?
    R
     
  2. chorny

    chorny New Member

    Joined:
    Jun 6, 2010
    Messages:
    20
    Likes Received:
    2
    Trophy Points:
    0
    Home Page:
    http://chorny.net
    Re: Identifying files before and after renaming - mp3 format finding end of id3v2 tag

    You can use Audio::Digest::MP3 from CPAN. It calculates digest from whole file. Or you can look into it's source and use MPEG::Audio::Frame directly.
     
  3. chorny

    chorny New Member

    Joined:
    Jun 6, 2010
    Messages:
    20
    Likes Received:
    2
    Trophy Points:
    0
    Home Page:
    http://chorny.net
    Re: Identifying files before and after renaming - mp3 format finding end of id3v2 tag

    Audio::Digest::MP3
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice