MP3 Tagging tools Back to the front door... |
So, I have been slowly migrating all of my CDs in to MP3s (not going to argue on FLAC vs MP3 - it's an educated personal choice) but I also have an existing MP3 collection from the CDs I had already ripped. When either ripping or tagging I ran into a couple of problem I couldn't find tools to solve, so I wrote them myself.
I have written two tools, mp3view and mp3gain, as well as an addon for Replay Gain v0.4 on OSX.
Download: ZIP archive containing patch and full code
I found Replay Gain v0.4 for OSX to be particular useful when tagging MP3s on OSX, to add replay gain tags to the files.
But the binary included only seems to work for adding the replay gain information into APE tags. I also require them in ID3v2 tags for backward compatibilty so have written an addon in PERL to read the APE information and add it to the ID3v2 tags.
You will need the following (assuming you have installed Replay Gain v0.4 for OSX first):
To install Audio::ApeTag (which I host on my site and not direct from Jeremy's GitHub page, because his implementation is a top level library rather than one under Audio and goes against the norm), simply unzip the archive linked above and run the following within the unzipped directory:
perl Makefile.pl make make test make install
make install will prompt you for your password to install this using sudo. Your account must have admin rights.
You have the option to either apply the patch files or copy across the full code to the Replay Gain install. Before completing the following, ensure Replay Gain is closed and not running. Within the unzipped archive directory...
Patching method:
sudo patch -b /Applications/ReplayGain\ Scan.app/Contents/Resources/script ./ReplayGain\ Scan/script.patch sudo patch -b /Applications/ReplayGain\ Scan.app/Contents/Resources/tag-files-with-rg.sh ./ReplayGain\ Scan/tag-files-with-rg.sh.patch sudo cp ./rgape2id3v2.pl /Applications/ReplayGain\ Scan.app/Contents/Resources sudo patch -b /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/script ./ReplayGain\ Full\ Rescan/script.patch sudo patch -b /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/tag-files-with-rg.sh ./ReplayGain\ Full\ Rescan/tag-files-with-rg.sh.patch sudo cp ./rgape2id3v2.pl /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources
Full code copy:
sudo cp /Applications/ReplayGain\ Scan.app/Contents/Resources/script /Applications/ReplayGain\ Scan.app/Contents/Resources/script.orig sudo cp /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/script /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/script.orig sudo cp ./ReplayGain\ Scan/script /Applications/ReplayGain\ Scan.app/Contents/Resources sudo cp ./ReplayGain\ Full\ Rescan/script /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources sudo cp /Applications/ReplayGain\ Scan.app/Contents/Resources/tag-files-with-rg.sh /Applications/ReplayGain\ Scan.app/Contents/Resources/tag-files-with-rg.sh.orig sudo cp /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/tag-files-with-rg.sh /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources/tag-files-with-rg.sh.orig sudo cp ./ReplayGain\ Scan/tag-files-with-rg.sh /Applications/ReplayGain\ Scan.app/Contents/Resources sudo cp ./ReplayGain\ Full\ Rescan/tag-files-with-rg.sh /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources sudo cp ./ReplayGain\ Scan/rgape2id3v2.pl /Applications/ReplayGain\ Scan.app/Contents/Resources sudo cp ./ReplayGain\ Full\ Rescan/rgape2id3v2.pl /Applications/ReplayGain\ Full\ Rescan.app/Contents/Resources
Open Replay Gain, drag a MP3 or a folder containing MP3s to the application, wait for scanning to complete (if necessary) and watch it execute the PERL script to copy the replay gain tags from the APE frames to the ID3v2 frames.
Download: mp3view2.pl - rename it from TXT to PL.
Unlike a lot of people, I strangely like to have my individual non-mixed tracks located in one flat folder and any mixes (such as Ministry Of Sound mix albums, etc...) go into another folder sorted by Albums in separate folders. I also embed all of my MP3s with the album art from the album it is from so they are fully portable across a multi-tude of systems.
Therefore, I want my original system kept as is for me, but software like Windows Media Center annoyingly requires you to have it structured in the 'Album Artist -> Album' directory structure with the album art stored as 'Folder.jpg'.
I will not be ranting about how rubbish that required structure is on a technical level; I have got over that now :). But instead, I wrote a PERL script that runs on my Linux NAS that does the following:
This is what I use - have it configured in Cron to run daily. Takes about 1 hour to process and shortcut 15000 MP3s. I then have iTunes, MediaMonkey, Windows Media Center, etc... to read / update it's library from the Samba share pointing to /c/Music/View
mp3view2.pl --delnonexists --createlinks --mp3dir=/c/Music --linksdir=/c/Music/View --recursive --excludemp3dir=/c/Music/View 2>&1 > /var/log/mp3view.log
Here's the usage information:
mp3view2.pl [--debug] --mp3dir=--linksdir= [--createlinks] [--delnonexists] [--skiperrs]|--help --createlinks ** PLEASE DO NOT USE THIS ON THE FIRST RUN - without ** ** it, we will show you tracks that don't have ID3v2 ** ** tags or don't have the AlbumArtist tag populated. ** ** ** ** Creates folders / links in --linksdir from MP3s ** ** found in --mp3dir. Any action that would have ** ** occurred is displayed on STDOUT prefixed by ** ** *ACTION*. This information is automatically ** ** included if you run with the --debug option. ** --debug Displays debug processing information --delnonexists If tracks have been removed / renamed, then links in the folder structure that point to MP3s that are not present in --mp3dir, are removed. --excludemp3dir If you have used the --recursive option and have dirs within the location specified in --mp3dir, you can add directories under it to an exclude list where we will not process any MP3s found. --help Displays this help information --linksdir=<path> Output folders for artists and albums including soft links to the actual tracks will be written here. --mp3dir=<path> Script will search for MP3s to create the links to represent a flat MP3 collection in a folder structure that Media Center et al. can understand. To specify multiple directories, separate them with a : (colon) The Location where the links / folders are written to is set by --linksdir option. ** THIS MUST BE A FULL RELATIVE PATH ** --recreate Can only be used with --createlinks. This will remove any existing links and recreate them. --recursive Use this option if you want us to recursively look for MP3s within the directories specified in --mp3dir --skiperrs If there are any errors with creating directories / links, then do not stop processing.
Download: mp3gain.pl - rename it from TXT to PL.
Download: metamp3.exe v0.92 beta 5 - required tool for this to work; install in the same directory as the PERL script.
When I am ripping my tracks from CD, I don't want the original tracks changed when it comes to the volume gain. However, I like the gain information to be written to the MP3s within the tags leaving it to the player to adjust the volume dynamically.
The tool I found most useful for this is metamp3.exe by Tycho. However, for it to write the Album Gain tag, you needed to supply the individual tracks that make up that album on the command line. This was something I wasn't willing to do manually and also wanted to have the gain tags written across multiple albums. Hence, I wrote this PERL script!
Here's the usage information:
mp3gain.pl [--debug] [--directory=] [--rescan] [--update]|--help --debug Displays debug processing information --directory=<path> Script will search for MP3s to analyse their volume gain information. By default, we use the current directory --help Displays this help information --rescan If volume gain information is found, instead of skipping the tracks, they will have the tag information deleted before scanning / updates take place (it's a limitation in metamp3.exe unfortunately) --update Updates the MP3s with volume gain information if it is found to be missing or inconsistent within the MP3s. It will also set Album Gain details for tracks.