CUETools Database

From CUETools
Jump to navigation Jump to search

You probably heard about AccurateRip, a wonderful database of CD rip checksums, which helps you make sure your CD rip is an exact copy of the original CD. What it can tell you is how many other people got the same data when copying this CD.

CUETools Database (CTDB) is an extension of this idea.

What are the advantages?

  • The most important feature is the ability not only to detect, but also correct small amounts of errors that occurred in the ripping process. That is, CTDB's purpose is not so much to tell a good rip from a bad rip (although it can be used for this), but more to provide a means to fix a rip, when the user is certain their copy is damaged and is confident that there is an undamaged one in the database. (The general rule-of-thumb will be that a CTDB confidence of 2/X or higher indicates that the rip in the database is probably undamaged.)
  • CTDB is free of the offset problems. You don't even need to set up offset correction for your CD drive to be able to verify and what's more important, submit rips to the database. Different pressings of the same CD are treated as the same disc by the database; it doesn't care.
  • CTDB doesn't require the length of the track#1 pregap (HTOA) or DATA track to verify your rip.
  • Verification results are easier to deal with. There are exactly three possible outcomes: the rip is correct, the rip contains correctable errors, or the rip is unknown (or contains errors beyond repair).
  • If there's a match, you can be certain it's really a match, because in addition to a recovery record, the database uses a well-known CRC32 checksum of the whole CD image (except for 10×588 offset samples in the first and last seconds of the disc). This checksum is used as a rip ID (CTDBID) in CTDB.

What are the downsides and limitations?

  • If your rip contains errors, the verification/correction process will involve downloading about 200kb of data (or possibly more for popular CDs), which is much more than it takes for AccurateRip.
  • The verification process is slower than with AccurateRip.
  • To verify or repair you need the whole CD rip. You can't verify or correct one track unless you have all tracks.
  • No verification or recovery of HTOA (Hidden Track One Audio).
  • No verification of the first 10 frames (~133 ms of audio) of the first track & the last 10 frames of the last track, whereas AccurateRip only excludes the first & last 5 frames (~67 ms).

How many errors can a rip contain and still be repairable?

  • That depends. The best case scenario is when there's one continuous damaged area up to 30-40 sectors (about half a second) long for most discs. As of CTDB 2.0, one continuous damaged area up to about 75 sectors (a second) on popular discs.
  • The worst case scenario is 4 non-continuous damaged sectors in (very) unlucky positions.

What information does the database contain per each CD?

  • CD TOC (Table Of Contents), i.e. length of every track (TOCID). Disc pregap length (HTOA) and/or CD-extra data track length stored separately (if any).
  • Offset-finding checksum, a small (16-byte) recovery record for a set of samples throughout the CD, which allows detection of the offset difference between the rip in the database and your rip, even if your rip contains some errors.
  • CRC32 of the whole disc (except HTOA and 5880 samples at each end). (CTDBID)
  • Submission date, artist, title.
  • 180KB recovery record (about twice that for more popular CDs), which is stored separately and accessed only when verifying a broken rip or repairing it.
  • Submission log, including user's IP addresses and CD drive model, which is used to eliminate erroneous submissions, virtual/faulty drives, and to verify if a submission by one user is independently confirmed.

What about the license?

  • The sample client library is open source, LGPL. (see Links below)
  • The server code is open source, LGPL. (see Links below)
  • The database contents is public domain, except for the submission logs, which are not publicly available to protect the privacy of people contributing to the database.

What software supports CTDB?

Submitting to CTDB

  • There's a CTDB plugin for recent versions of Exact Audio Copy (EAC).
  • CUERipper, an EAC alternative that's part of the CUETools package, supports CTDB natively.
  • CUETools can submit a disc to CTDB when verifying the image in default 'Verify' mode (requires AccurateRip confidence > 1 and no previous entry found in CTDB).

Disc image repair

  • CUETools can repair a damaged CD image if the disc is in CTDB and if the damage is not too severe.