Take the 2-minute tour ×

Basically, I've got a bunch of music files yoinked from my brother's iPod that retain their metadata but have those absolutely horrendous four character names the iPod seems to like storing them under. I figured I'd write a nice, quick script to just rename them as I wished, but I'm curious about any good libraries for reading ID3 metadata. I'd prefer either Perl or Python. I'm comfortable with Perl since I use it at work, whereas Python I need more practice in and it'll make my Python evangelist friends happy.

Anyway, shortened version: Can you name a good library/module for either Python or Perl that will allow me to easily extract ID3 metadata from a pile of mp3s?

share|improve this question

closed as off-topic by Joeytje50, Lightness Races in Orbit, Jefffrey, mhlester, lpapp May 21 at 1:20


  • "Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Joeytje50, Lightness Races in Orbit, Jefffrey, mhlester, lpapp

7 Answers 7

up vote 0 down vote accepted

MP3::Tag is a also great. Again, if you are looking for a Perl module, head over to search.cpan.org first.

 use MP3::Tag;


  # get some information about the file in the easiest way
  ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
  # Or:
  $comment = $mp3->comment();
    = $mp3->select_id3v2_frame_by_descr('COMM(fre,fra,eng,#0)[dedicated to]');

  $mp3->title_set('New title');         # Edit in-memory copy
  $mp3->select_id3v2_frame_by_descr('TALB', 'New album name'); # Edit in memory
  $mp3->select_id3v2_frame_by_descr('RBUF', $n1, $n2, $n3);    # Edit in memory
  $mp3->update_tags(year => 1866);      # Edit in-memory, and commit to file
  $mp3->update_tags();                  # Commit to file
share|improve this answer
Well, metacpan.org has a nicer look and feel than search.cpan.org. But, yes, CPAN has all the answers :) –  Dave Cross Apr 8 '13 at 14:50

CPAN Search turns up several Perl modules when you search for ID3. The answer to almost any Perl question that starts with "Is there a library..." is to check CPAN.

share|improve this answer

here are few python libs



http://code.google.com/p/mutagen/ [updated URL]

share|improve this answer
I have used mutagen before, it works very well. –  Matt Jun 17 '09 at 2:35
ive used mutagen's EasyID3 class a lot, and its great on the whole. it can't read tags that aren't at the beginning of a file, though, which is a downer. –  Carson Jan 7 '10 at 18:33

I've had good luck with MP3::Info.

share|improve this answer

I think this snippet: Rename MP3 files from ID3 tags from python recipies might be helpful. It uses id3reader lib.

share|improve this answer

The Python Package Index has a list of python packages matching a search for 'id3' here, the top several of which appear to be related to your needs. As with brian's answer above, the answer to any "is there a python module that..." probably starts with PyPI.

share|improve this answer
