James
James

Reputation: 31738

How to strip MP3 tags from raw data (ID3v1, ID3v2)

I am looking to strip all metadata (tags) out of an mp3 byte[] to leave just the audio data.

  1. Is there an existing library capable of doing this? (if so, could an example be given)
  2. If ! step 1, is there a good example of someome doing this manually (a snippet would be great, any language)?

Upvotes: 0

Views: 691

Answers (2)

James
James

Reputation: 31738

Doing more Googling, I found this snippet:

    // Get the ID3 tag size and flags; see 3.1
    int tagsize = (headerbuf[9] & 0xFF) | ((headerbuf[8] & 0xFF) << 7 ) | ((headerbuf[7] & 0xFF) << 14 ) | ((headerbuf[6] & 0xFF) << 21 ) + 10;
    boolean has_extended_hdr = (headerbuf[5] & 0x40) != 0 ? true : false;

    // Read the extended header length and skip it
    if ( has_extended_hdr )
    {
        int headersize = file.read() << 21 | file.read() << 14 | file.read() << 7 | file.read(); 
        file.skipBytes( headersize - 4 );
    }

source: http://www.ulduzsoft.com/2012/07/parsing-id3v2-tags-in-the-mp3-files/

Upvotes: 0

COLD TOLD
COLD TOLD

Reputation: 13579

Try looking at the following libraries maybe it will help you

http://www.novell.com/products/linuxpackages/opensuse11.1/taglib-sharp.html

https://github.com/mono/taglib-sharp

Upvotes: 1

Related Questions