Introduction
CD+G, CD plus Graphics, adds pictures to an audio CD by storing them in the subcode channels R to W. Its main use is karaoke discs, where it shows the lyrics. FFmpeg reads the graphics data as a .cdg file.
Structure
The data is a run of 24-byte packets. On the disc each sector carries four of them in its 96 subchannel bytes.
- 1 byte command: a packet carries graphics when its low 6 bits equal 9
- 1 byte instruction
- 2 bytes Q parity
- 16 bytes data
- 4 bytes P parity
The picture is a raster of 300 × 216 pixels, with a safe area of 294 × 204, showing 16 colours out of 4096.
Not described
This page is a short summary. The drawing instructions are not yet described here, and there is no viewer for CDG files.
Known, not yet covered
- Reference: each graphics instruction and the layout of its data bytes.
- Viewer: drawing the graphics in time with the audio.
Links
Software
- FFmpeg – media toolkit with a CD Graphics reader
Reference
- CD+G Revealed – Jim Bumgardner's description of the format
- cdg.c – FFmpeg's CD Graphics reader