After Hours

How to tag all your audio files in the fastest possible way

Marco Fioretti shows you his method for tagging MP3 files with as much automation as possible so that you can impose a little order on music or other audio collections.

Last week, I promised that this time I'd introduce efficient ways to add ID3 tags to MP3 files. For me, adding such tags is an absolute necessity. If I really want my MP3 files to be and remain properly sorted and quickly usable even if I change software, I must guarantee that:

  • They are indexable through an open standard that many software tools can process automatically.
  • The corresponding data are written inside the files themselves, to follow them when the files move to another computer or operating system, and inside backups.

This said, let me make clear from the beginning that "the fastest possible way to tag MP3 files" can still involve a lot of manual work. Actual songs often are not a big deal, but MP3 audio can be anything. My own MP3 collection contains both songs directly ripped and fully tagged, in one round, from my own CDs, and other files from everywhere, all encoded without any tags. Most of those "non-song" files of mine are either:

  • Digitized analog recordings (you know what I mean: things like me singing "Merry Christmas" in kindergarten...), normally made by relatives and friends who have no clue of what tagging is, or...
  • Podcasts from "professional" radio stations, that were very unprofessionally published online without any tagging whatsoever.

Tagging songs with a graphic interface

Many music files are catalogued in several online databases. The most famous ones that are managed in an Open Source way and fully compatible with Linux are FreeDB and MusicBrainz. I have used Picard, the official MusicBrainz tagger, to tag semi-automatically the majority of my music files. The process, described in detail here, consists of these main steps:

  1. File Loading:
    • Launch Picard, select View | File Browser in the top menu.
    • Find in the Browser your music folder and drop it in the left Picard pane. Picard will put untagged files in its "Unmatched Files" folders and already tagged albums in its right pane
    • If there are files that Picard doesn't recognize, you should probably remove them
  2. Clustering:
    • Click on "Cluster", and Picard will rearrange the "Unmatched files" files likely to belong to the same album into album clusters.
  3. Automatic, metadata-based lookup:
    • Select unmatched files or albums and click on "Lookup": Picard will use the (few) tags they may already contain to fetch other data from MusicBrainz and put all the albums it recognizes in this way in the right pane
    • At least initially, do this only on a few files or albums at a time, to understand how Picard works
    • Inside those albums (See Figure A at right), tracks actually present on your drive are represented with coloured rectangles (red means bad match, green good or perfect match), the others with music notes.
  4. Automatic, "fingerprint" based lookup:
    • If you click on "Scan" after selecting some files, Picard will calculate their Acoustid "fingerprint" and compare them against those in the online database. If there's a match, Picard will download all the tags for those songs (see Figure B below).
    • This option works on uncompressed audio, not MP3 files, so it is normally useful (only) when you first rip songs from a CD, where they are uncompressed but untagged.
  5. Manual tagging and reordering
    • At this point, check what Picard did automatically and:
    • Manually drag and drop in the right album files that you know, but are still unmatched.
    • Select all the files and albums that are properly tagged and "Save" (right-click menu): only at this point the ID3 tags will be written inside the files, making them ready for automatic reordering with Picard itself, my script, or other methods.

Figure B

And now one shell way to tag MP3 files

The easiest way to prepare non-song MP3 files for proper tagging is to give them consistent and meaningful names. Once that precondition is verified, you can automatically use those names to write tags with a script like this:

   1 #! /bin/bash
   3 for SONG in `find $1 -type f -name "*mp3"`
   4     do
   5        TITLE=`basename $SONG | cut -d_ -f1 | tr "-" " "`
   6        LEAD=`basename  $SONG | cut -d_ -f2 | tr "-" " "`
   7        YEAR=`basename  $SONG | cut -d_ -f3 | cut -c1-4`
   8        id3tag   --song="\"$TITLE\"" $SONG
   9        id3tag  --album="\"$TITLE\"" $SONG
  10        id3tag --artist="\"$LEAD\"" $SONG
  11        id3tag       -y$YEAR $SONG
  12     done
  13     exit

Here I assume that each file has a name in the format TITLE_LEAD_DATE.mp3, with the first four characters of the DATE being the YEAR of recording. Of course, once you get the trick, you can easily hack the script to work with any other (constant!) naming format. Lines 5 to 7 extract title, lead and year from the file name, replacing hyphens with spaces: a file named The-Wall_Pink-Floyd-19791130.mp3 will return "The Wall" for TITLE, "Pink Floyd" as LEAD and 1979 as YEAR. Once these strings are inside shell variables, we only have to call the id3tag program (lines 8 to 11) to write each tag inside the file. Easy, isn't it?


Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.


I've created my own auto-tagger, too. It is called taghycardia. It draws the info for the auto-tagging both from the clues already present in the files and from the discogs online database. In particular, this combination speeds up the auto embedding of cover art. The app is free, has no special requirements like java or .net, and highly compact.


i actually think the problem has to do with the server (shoutcast in my case). even when the file plays from the server directly, winamp doesn't show the pic or further info. it is all very disappointing. the host music server can't help me actually.


You organize your music into folders, and it uses the folder names and updates the tags. Genre -> Band Name -> Album name -> File If the song name tag is blank, it sets it to the file name minus the extension. So I then organize my files manually, and then drop the top most folder on top of my exe I built and it recursively works through all the sub folders and changes the tags on every mp3 and WMA file.


I have a similar need but for pictures. Any thoughts?


Hello there, regarding all tag procedures i would like to post a problem i face with tagging: i have tagged all my music files using mp3tag and stream them with sam broadcaster on the web radio i own. when i use winamp to listen to the stream i can't see any of the details i have added (no pic, no comment etc.). when i use winamp to play the tracks from the hard drive all details are visible.. any hints? regards salvatore comi


the basic tool for doing the same thing with pictures on Linux is exiftool, a command line utility that can read and write EXIF and other tags that work as the ID3 ones do for music. Maybe I'll cover that some day


Hi salvatore, from what you write, it sounds likely that sam broadcaster is not transmitting the tags for some reasons. I don't know that program, but maybe you should ask to its developers, if there is some configuration setting to change

Editor's Picks