Extraction Of ID3 tags – Code in Python

Posted: July 19, 2010 in Python

Hmm….here is a new one…what is under consideration now is the extraction of ID3 tags. Media players usually display a description of the files played by it. These descriptions are encoded in the file being played. ID3 tags are components of an mp3 file where the name of the song, the artist, the album etc are written. ID3 tags starts from the 128th character position from the end of the file.

This is how an ID3 an tag is formed:-

Field Length Description
header 3 “TAG”
title 30 30 characters of the title
artist 30 30 characters of the artist name
album 30 30 characters of the album name
year 4 A four-digit year
comment 28 or 30 The comment.
zero-byte 1 If a track number is stored, this byte contains a binary 0.
track 1 The number of the track on the album, or 0. Invalid, if previous byte is not a binary 0.
genre 1 Index in a list of genres, or 255

Courtesy : Wikipedia

This information can be made useful to extract ID3 tags from an mp3 file. Here is a simple python code demonstrating how the file descriptions can be extracted from a given mp3 file.

Download Complete Source Here :-

id3.py


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s