top of page

MP3 METADATA EDITOR

This is a demo of a project that I did in my undergraduate third year. It is a python program that can be used to edit the metadata of mp3 files. I haven't used any APIs for this. I studied the ID3 standard and wrote a program to manipulate the metadata.

Description

This is a project called ‘MP3 Metadata Editor’. It is python program to edit the metadata of an mp3 file. ID3  tags is a standard used by the MP3 audio file format for its metadata. It allows information such as the title, artist, album, track number, and other information about the file to be stored in the file itself. My program works on ID3v2 (version 2.x) tags which are of variable size, and usually occur at the start of the file, to aid streaming media. They consist of a number of frames, each of which contains a piece of metadata. For example, the TIT2 frame contains the title, and the WOAR frame contains the URL of the artist's website. Frames can be up to 16MB in length, while total tag size is limited to 256MB. I studied the structure of these frames and wrote a program to locate and edit the data field of a frame and accordingly update its size and flags.

​

Structure of ID3v2 metadata container:

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 | Header (10 bytes)                                                                             |

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 | Extended Header                                                                              |

 | (variable length, OPTIONAL)                                                        |

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 | Frames (variable length)                                                                  |

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 | Padding                                                                                               |

 | (variable length, OPTIONAL)                                                        |

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 | Footer (10 bytes, OPTIONAL)                                                     |

 +-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +

 

The tag consists of a tag header and a tag body with one or more frames. All the frames consists of a frame header followed by one or more fields containing the actual information. The layout of the frame header: 

Frame ID       $xx xx xx xx (four bytes)

Size                 $xx xx xx xx

Flags               $xx xx

This is followed by the actual data field.

bottom of page