Optical disc and disc image notes

These pages explain how CDs and DVDs store data, from the plastic up to the bytes in an image file. They then show how the common image formats (ISO, BIN/CUE, MDS/MDF, IMG/CCD/SUB) record, or fail to record, each part of a disc.

They are written to be read in order. Each page defines its terms the first time it uses them. The glossary collects those definitions in one place.

Reading order #

Part 1: The disc #

  1. Physical layout: CDs and DVDs. The plastic, the spiral, pits and lands, the regions of the disc by radius, and how recordable and dual-layer discs differ.
  2. On-disk encoding. How bytes become pits: EFM, frames, sectors, sector modes (audio, Mode 1, Mode 2 / XA Form 1 and 2), scrambling, the lead-in, program area and lead-out, and the DVD equivalents.
  3. Subchannels. The eight P–W side channels that run alongside every CD sector: the Q channel's position and TOC data, CD-TEXT, CD+G, and the different ways image files lay out the 96 subchannel bytes.
  4. Logical Block Addressing (LBA). MSF times, LBAs, negative addresses, DVD physical sector numbers, and how to convert between them and file offsets.
  5. Tracks. Track types, control flags, indexes, pregaps and postgaps, and the rules for moving between audio and data.
  6. Sessions. Single-session and multisession discs, lead-in and lead-out sizes, the multisession TOC pointers, recording modes (DAO/TAO/SAO), and DVD borders.
  7. EDC/ECC. The three layers of error handling on a CD (CIRC, then EDC and the Reed-Solomon P/Q parity), DVD's RS product code, and exact algorithms for computing the sector-level codes.

Part 2: Image file formats #

  1. ISO (.iso). A plain run of 2048-byte user-data sectors, plus the ISO 9660 and UDF filesystems usually found inside.
  2. BIN/CUE (.bin + .cue). CDRWIN's text cue sheet and raw sector file(s).
  3. MDS/MDF (.mds + .mdf). Alcohol 120%'s binary descriptor and its sector data file.
  4. IMG/CCD/SUB (.img + .ccd + .sub). CloneCD's raw image, text TOC, and separate subchannel file.

Which format keeps what #

A quick comparison. Each format page explains its row in detail.

Feature ISO BIN/CUE MDS/MDF IMG/CCD/SUB
Multiple tracks no yes yes yes
Audio tracks no yes yes yes
Raw 2352-byte sectors (sync, header, EDC/ECC) no (usually) optional (per track) optional (per track) always
Subchannel data no only for CDG tracks optional (interleaved, inside the MDF) yes (separate .sub, linear)
Multiple sessions no via REM SESSION extension yes yes
Full TOC (lead-in Q entries) no no (rebuilt by the reader) yes yes
Pregap (index 0) sectors stored n/a depends on PREGAP vs INDEX 00 track 1 never; others: see page track 1 never; others yes
CD-TEXT no partly (TITLE, PERFORMER, ... or CDTEXTFILE) unknown yes ([CDText])
MCN / ISRC no yes (CATALOG, ISRC) only inside stored subchannel yes (CATALOG, ISRC) and in .sub
DVD support yes no (CD only in practice) yes (with PFI/DMI and BCA) no
DVD physical structures (PFI, DMI, BCA) no no yes no
Copy-protection measurements (DPM) no no yes no

Conventions used throughout #

  • Hex numbers are written either 0x930 or 930h. Both mean 2352.
  • Byte offsets inside a structure are hex and start at 0, unless stated otherwise.
  • MSF is written mm:ss:ff (minutes, seconds, frames), 75 frames per second.
  • LBA 0 is the sector at MSF 00:02:00 on a CD, and the first sector of the data area on a DVD. See LBA.
  • "Raw" sector means all 2352 bytes of a CD sector. "Cooked" sector means only the user-data part (usually 2048 bytes).
  • Facts taken from reverse-engineered sources, rather than published standards, say so. Where sources disagree, the page shows both views.

Primary references #

These are cited throughout. Each page also lists its own sources.