Read MP3 ID3 Tags in Perl

The package I use for simple tag reading is MP3::Tag, available on CPAN with more information here.

The following example shows how easy it is to retrieve tags from an MP3 file.

use MP3::Tag;
 
my $file = MP3::Tag->new($filename);
 
my ($title, $track, $artist, $album, $comment, $year, $genre) = $file->autoinfo();
 
print "Title: [$title]\n";
print "Artist: [$artist]\n";
print "Album: [$album]\n";
print "Track: [$track]\n";
print "Year: [$year]\n";
print "Genre: [$genre]\n";
print "Comment: [$comment]\n\n";

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">