CD Backup

Home » CD Backup » Using EAC, MAC, TAG and PAR2 To Back-Up a CD

Using EAC, MAC, TAG and PAR2 To Back-Up a CD

This guide explains the steps necessary to:

The guide uses batch files to perform the above processes automatically (i.e.: EAC calls the first batch file as an "external encoder", and all the above steps are undertaken in sequence).

This is version two of my guide. You can still read the original. The original guide was a simplified version of this document. This guide describes the exact method that I have used to backup my entire CD collection. The original guide documented the core process that I conceived to fulfil my requirements (steps 1 to 4 above).

Update: Dirk Westerfer has kindly adapted the batch files to use FLAC. If you would prefer to use FLAC over Monkey's Audio, download Dirk's batch files. Dirk's files pass the year and genre information from EAC, and also embed the EAC log file in the FLAC image. You will need to use a command line like:

/c C:\dos\eac-enc-flac.bat %o %s %d "%a" "%g" "%m" "%y" %hHIGH%h %lLOW%l DISCNO

... instead of the command line quoted later. Please read on for other valuable information though.

What You Need

To implement this guide you will need the following:

The batch files will work on Windows NT, 2000 & XP (it's possible that they will work on Windows 98, but you would have to reference to COMMAND.COM, instead of CMD.EXE). These are the most complicated batch files I have written, yet they are far from complicated (after seeing some of the examples I referenced), so I'm sure most of you could adapt them to your needs.

If you are eager to get going, here's some direct links, but be warned: these links will become obsolete - it is always best to go to the website and get the latest version.

Exact Audio Copy v0.95b4 (2.29MB)   Monkey's Audio v4.01b2 (1.24MB)   Tag v2.0.47 (194KB)   par2cmdline v0.4 (127KB)   The batch files (3KB)

Get The Applications and Batch Files Set Up

If you don't already have them, download all the necessary applications, and my batch files (3KB).

As Monkey's Audio is an installer I let it install to the default path, "C:\Program Files\Monkey's Audio". Similarly, Exact Audio Copy is located in "C:\Program Files\Exact Audio Copy". All the other files (TAG.EXE, PAR2.EXE, eac-enc.bat and eac-post.bat) are in my folder "C:\DOS". I have added the path to this folder to the system variable "PATH", which means that I can run them from the command prompt from any folder without having to fully qualify the path. This isn't necessary for this guide, as the batch file uses the full path, for portability.

Amending the Batch File "eac-enc.bat"

This file stores the paths to MAC.EXE, TAG.EXE, PAR2.EXE, and also the paths used for the CSV file and "<artist>\<album>" folders. These lines can be found very near the top:

REM ######################################################
REM  PLEASE EDIT THE PATHS TO THE NECESSARY APPLICATIONS
REM =====================================================
SET pathToMac="C:\Program Files\Monkey's Audio\MAC.EXE"
SET pathToTag="C:\DOS\TAG.EXE"
SET pathToPar2="C:\DOS\PAR2.EXE"
REM =====================================================
REM  PLEASE EDIT THE PATHS TO THE STORAGE FOLDERS
REM =====================================================
SET apeFolder=E:\CDBackup\APE

SET csvLogFolder=E:\CDBackup\Log

"apeFolder" is the root folder in which the "<artist>\<album>" folders will be created.
"csvLogFolder" if the folder in which the CSV file will be created and appended to.

A batch file is just a plain text file, so you can open it in Notepad, or a text editor of your choice (EditPlus is mine). Change all paths to match the correct paths for your PC, and save.

Exact Audio Copy

If you have never used Exact Audio Copy before I would suggest you first take some time to familiarise yourself with it. Setting up Exact Audio Copy is out of the scope of this document. I would suggest taking a look at the links page on the Exact Audio Copy website. There are also some excellent tutorials at The Coaster Factory.

Once you are familiar with Exact Audio Copy you are ready to begin.

Creating a New Compression Profile

I would suggest that you create a new Compression Profile for this process. Exact Audio Copy has an excellent profiling setup where you can save a complete profile (all program settings), or just a profile of one option group - in this case, Compression.

At the bottom of the main Exact Audio Copy window you should see your profile selector, as below.

Profile selector

You will see from the screenshot that I currently have my "CMD" compression profile selected. To create a new profile:

You have now created a copy of your previous compression profile. We will change the compression settings and then save the profile. You can create numerous compression profiles (e.g.: create one for MP3 encoding) and use the dropdown list and "Load" button to switch between them.

Setting the Compression Options

From the menu select EAC > Compression Options... (or press F11). You will be presented with a dialogue as below.

This screenshot shows the dialogue correctly setup (for my PC at least) for this guide.

EAC's Compression options dialogue

As per above, please do the following:

  1. Check "Use external program for compression"
  2. Select "User Defined Encoder" from the dropdown list
  3. Enter ".ape" for the required file extension
  4. Use the "Browse..." button to locate CMD.EXE in the system32 folder. This may vary for NT or XP
  5. In "Additional command line options" enter the following text:

    /c C:\dos\eac-enc.bat %o %s %d "%a" "%g" %hHIGH%h %lLOW%l DISCNO

    Enter the text exactly as shown, with two exceptions:
  6. Check "Delete WAV after compression"

NB: You will see from the Compression Options screenshot that there is a "High quality" and "Low quality" radio button on the Compression Options dialogue. This is relevant to the "%hHIGH%h %lLOW%l" portion of the command line options. If you select the "High quality" radio button the APE file will be encoded using "Extra High" compression (my preferred compression level). If you select "Low quality" the APE file will be encoded using "Normal" compression.

Once you have set up the dialogue as above, amending the path to the batch file if required, click OK. From the main Exact Audio Copy window save your new compression profile by clicking the Save button.

Begin The Encoding

From the menu select Action > Copy Image & Create CUE Sheet > Compressed...

From the dialogue select where you would like to save your files. If you wish, change the name of the file from the default of "CDImage". I leave it as "CDImage", as it can be distinguished after processing by it's full final path (e.g.: "E:\CDBackup\APE\Pixies\Doolittle\CDImage.ape").

Once you click Save on the file dialogue the process will begin.

The process is as follows:

  1. Exact Audio Copy will rip the CD to a WAV file in the folder you specified, with the name you specified, e.g.: "CDImage.wav". This process will be represented by an Exact Audio Copy dialogue showing the progress of the rip
  2. Once the WAV file has been created it will be renamed to a temporary value
  3. Exact Audio Copy will call CMD.EXE, which will run the batch file eac-enc.bat
  4. eac-enc.bat will load into a shell, list all relevant variables, and then run MAC.EXE to begin encoding the WAV to APE
  5. Once the file has been encoded eac-enc.bat will open a new shell which will run eac-post.bat
  6. eac-enc.bat will close
  7. Exact Audio Copy, thinking the process to be over (it knows nothing of eac-post.bat), will display a completion dialogue and rename the APE file to the name you specified, e.g.: "CDImage.ape"
  8. eac-post.bat will wait for the APE file to be renamed. This wait should be unnoticeable, but the batch file must check in case the renaming has taken longer than the time it took the new shell to open
  9. eac-post.bat will run TAG.EXE to load the cuesheet generated by Exact Audio Copy, and set it to the APE file's APEv2 CUESHEET tag. It will also set the Artist and Album tags, using information passed from Exact Audio Copy (the parameters "%a" and "%g")
  10. eac-post.bat will run PAR2.EXE to create the PAR2 parity files
  11. eac-post.bat will run MAC.EXE to verify the APE file
  12. eac-post.bat will pause, waiting for the user to close EAC's completion dialogue. This is required as EAC's log is not created until this dialogue is closed. Once the user closes the dialogue they need to press any key while focussed on the batch file window, to allow the process to complete. NB: the final processes usually execute instantaneously, therefore this pause does not interrupt the process part way though, but right at the end
  13. eac-post.bat will wait until the log file exists
  14. eac-post.bat will append the disc details to the CSV file. If the CSV file does not exist it will create it first, and enter the field headers
  15. eac-post.bat will create the "<artist>\<album>" folder, and move all files into it

View the example outputs for both eac-enc.bat and eac-post.bat. View the example log created for the same run.

Check the Results

You will now have five separate types of file in the "<artist>\<album>" folder:

  1. The APE file ("CDImage.ape")
  2. The cuesheet ("CDImage.ape.cue")
  3. Various PAR2 files ("CDImage.ape.par2", etc.)
  4. eac-enc's log file ("eac-enc.log")
  5. EAC's log file ("<album>.log")

The cuesheet has been stored in the APE file, so you don't really need it. However, when you are backing up to a 4.7GB DVD another 2KB of cuesheet per album is negligible, and therefore I keep it anyway.

Other Relevant EAC Settings

Storing CD-Text Information in the Cuesheet

To store artist, album and track information in the cuesheet you will need to select EAC > EAC Options... from the menu (or press F9), select the "Tools" tab, and make sure the checkbox "Use CD-Text information in CUE sheet generation" is selected.

Creating a Log File Automatically

Exact Audio Copy will give you the opportunity to save the results to a log file at the end of the process, but you can specify that you want a log file created automatically. To achieve this, you will need to select EAC > EAC Options... from the menu (or press F9), select the "Tools" tab, and make sure the checkbox "Automatically write status report after extraction" is selected.

Possible Improvements and Amendments

For a list of possible improvements and amendments please see my original guide. Not all will still be relevant, but some are, and the code used may help you implement the changes you require.

If you are still in the dark feel free to email me, and I will try to help.

Testing

While trying to achieve my goal of automating this process I spent some time testing MAREO, and then a little more honing these batch files (3KB).

In order to stop each testing phase taking an age I used the following technique, which is neither revolutionary or complex, but I thought I would share none the less.

Create a Small Audio CD

To achieve this I used Nero. I opened a new session for an Audio CD, dragged a couple of MP3s into the pot, and then recorded to the Image Drive, creating a Nero image (NRG file) 66MB in size. I guess you could also make an image of a CD single, using your favourite CD copier (Clone CD version 4.2.0.2 for me).

Mount to a Virtual CD Drive

If you don't already run a virtual CD/DVD drive I would recommend the free, and widely acclaimed, Daemon Tools.

Whatever your virtual CD-ROM of choice, mount the Nero image to your virtual drive, and then use that "CD" in Exact Audio Copy. Exact Audio Copy can read virtual images very fast, and our CD is very short, so the ripping process is lightening. This lets you quickly get into the processing phase - spending more time testing your setup, and less time watching progress bars.

What Now?

Read my accompanying guides:

The History

A short time ago I decided to backup my CD collection. I have maintained an extensive collection of MP3s for a few years, and have recently begun to think about a better backup approach.

I was originally simply considering LAME 192Kbps VBR MP3. However, I started hanging around the Hydrogen Audio forums, and soon realised that I needed to go with lossless compression. I had played around with Monkey's Audio over a year ago, but never did anything worthwhile with it. I read the threads and tested out a few other codecs, including FLAC, OptimFrog, La and WavPack.

There is lots of discussion about which lossless codec is best. On the assumption that they do all work as expected (i.e.: can encode and decode without loss of quality) it seems to me that it mainly comes down to what you are using the files for. FLAC has been optimised to decode very quickly, so is good for everyday use - but it's files are slightly bigger than Monkey's Audio or La. La seems to get very good compression results - but is slow, and processor hungry, to decode. I opted for Monkey's Audio for these reasons:

There's little point in me going into the whole story in detail again, and you've probably stopped reading this by now anyway, but for the full history behind this development please read this forum thread at Hydrogen Audio. Sufficing to say I've had to put in a little work (Tag, Batch Files) to get the set up I wanted. I think it was Mark Twain who once said, "No pain, no gain". Or was it BA Baracus?

Document Version History

Version Date Comment
2.3 2006-12-04 Updated direct links to software. Updated eac-post.bat to cope with EAC 0.95b4 cuesheet naming.
2.2 2005-06-05 Updated direct links to software.
2.1 2005-03-10 Added links to my new accomanying guides.
2.0 2004-10-23 Initial rewrite of the original guide.

 

Jump: Top | What You Need | Get The Applications and Batch Files Set Up | Exact Audio Copy | Possible Improvements and Amendments | Testing | What Now? | The History


Home | CueMake | Tag | Wapet | CD Backup | Email Me


This document has been printed from http://www.neilpopham.pwp.blueyonder.co.uk/