sábado, 16 de febrero de 2013

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


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 remainproperly 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 beanything. 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
   2
   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?

source: http://www.techrepublic.com/blog/opensource/how-to-automatically-rename-and-reorder-mp3-files/3425

No hay comentarios:

Publicar un comentario