Skip to content

Linux CLI tool that rips audio CDs to FLAC instant and continuously, fetches metadata from CDDB and inserts tags and cover images🎵

Notifications You must be signed in to change notification settings

kekyo/scheme-cd-ripper

Repository files navigation

Scheme CD music/sound ripper

Scheme CD Ripper is a linux CLI tool that rips audio CDs to FLAC.

cdrip

Project Status: Active – The project has reached a stable, usable state and is being actively developed. License: MIT

Packages are available in (Debian/Ubuntu): https://github.com/kekyo/scheme-cd-ripper/releases


(Japanese language is here/日本語はこちら)

What is this?

Scheme CD Ripper is a linux CLI tool that rips audio CDs to FLAC, automatic fetches metadata from multiple CDDB servers and inserts tags into FLAC file.

This workflow is designed for processing large numbers of CDs continuously, for archiving usage.

Features

  • Encode and save audio tracks as FLAC while performing music stream integrity checks (with cd-paranoia).
  • Reads the disc TOC, queries multiple CDDB servers and MusicBrainz. Merges all matches, and prompts you to pick a candidate.
  • Inserts Vorbis comments (ID3 like tags in FLAC format) automatically. Furthermore, if a cover art image exists at Discogs/CAA, it can be automatically embedded. And, the flexible metadata auto-search feature and candidate regular expression filters reduce the burden of automatic tagging.
  • File names and directories can be automated using your specified format with tags.
  • And since it uses GNOME GIO (GVfs) for file output, you can output directly to a NAS or similar device using a URL.
  • Supports continuous mode for efficient operation of multiple CDs.

Example session


Installation

For Debian (trixie, bookworm) / Ubuntu (noble, jammy), prebuilt binaries are available here. There are two packages available (cdrip.deb, libcdrip-dev.deb), but if you only need to use cdrip command, installing just the first one is sufficient. The second one is an API library for C language when you want to use this feature.

For environments other than those listed above, you can build it yourself. In that case, please refer to Self Building.

CLI Usage

Simply run the cdrip command, and it will detect your PC's CD drive and start working. Ripped FLAC files are stored in subdirectories under the album name, created within the current directory:

cdrip

The default options are configured for easy use of cdrip. Of course, you can adjust them to your preferences as follows:

cdrip -d /dev/sr1 -f "{artist:n/title:n}.flac" -r

The following are the options:

  • -d, --device: CD device path (/dev/cdrom or others). If not specified, it will automatically detect available CD devices and list them.
  • -f, --format: FLAC destination path format. using tag names inside {}, tags are case-insensitive. (see below)
  • -m, --mode: Integrity check mode: best (full integrity checks, default), fast (disabled any checks)
  • -c, --compression: FLAC compression level (default: auto (best --> 5, fast --> 1))
  • -w, --max-width: Cover art max width in pixels (default: 512)
  • -s, --sort: Sort CDDB results by album name on the prompt.
  • -ft, --filter-title: Filter CDDB candidates by title using case-insensitive regex (UTF-8)
  • -nr, --no-recrawl: Disable MusicBrainz recrawl from CDDB titles.
  • -r, --repeat: Prompt for next disc after finishing.
  • -ne, --no-eject: Keep disc in the drive after ripping finishes.
  • -a, --auto: Enable fully automatic mode (without any prompts). It picks the first drive that already has media, chooses the first CDDB match, and loops in repeat mode without prompts.
  • -ss, --speed-slow: Request 1x drive read speed when ripping starts (default).
  • -sf, --speed-fast: Request maximum drive read speed when ripping starts.
  • -dc, --discogs: Discogs cover art preference: no, always (default), fallback.
  • -na, --no-aa: Disable cover art ANSI/ASCII art output.
  • -l, --logs: Print debug logs.
  • -i, --input: cdrip config file path (default search: ./cdrip.conf --> ~/.cdrip.conf)
  • -u, --update <file|dir> [more ...]: Update existing FLAC tags from CDDB using embedded tags (other options ignored)

All command-line options (except -u and -i) can override the contents of the config file specified with -i.

TIPS: If you want to import a large number of CDs continuously with MusicBrainz tagging, you can do so by specifying the cdrip -a -r option. Additionally, when ripping CDs from the same series, using the -ft option to narrow down the titles somewhat can reduce mistakes in selecting CDDB candidates.

TIPS: Some hardware media players malfunction when the compression level is set to 6 or higher. Therefore, the default for Scheme CD ripper is set to 5.

Inserting CDDB Tags

You can automatically retrieve track information from CDDB servers or MusicBrainz to automatically apply track names or add Vorbis comments (similar to ID3 tags in FLAC).

You can also merge information from multiple CDDB servers. Specify one or more candidates separated by commas or spaces. The candidate with the first specified number takes precedence, followed by subsequent ones. The genre tag (genre) is automatically merged.

The following example applies candidates 3 and 12 in sequence:

Fetcing from CDDB servers ...

[1] BarlowGirl - For the Beauty of the Earth (Studio Series) (via freedb (japan))
[2] Bomani "D'mite" Armah - Read a Book Single (via freedb (japan))
[3] Stellar Kart - Angel In Chorus (Studio Series) (via freedb (japan))
[4] Disney - Shanna (via dbpoweramp)
[5] Ladina - Verbotene Liebe (via dbpoweramp)
[6] Across The Sky - Found By You [Studio Series]  (2003) (via dbpoweramp)
[7] Bomani "D'mite" Armah - Read a Book Single (via dbpoweramp)
[8] Cuba Libre - Sierra Madre (via dbpoweramp)
[9] Big Daddy Weave - You're Worthy Of My Praise(Studio Series) (via dbpoweramp)
[10] BarlowGirl - For the Beauty of the Earth (Studio Series) (via dbpoweramp)
[11] Crossroads - Unknown (via dbpoweramp)
[12] Stellar Kart - Angel In Chorus (Studio Series) (via dbpoweramp)
[13] Tigertown - Wandering Eyes EP (via dbpoweramp)
[14] Jerry Smith - Twinkle Tracks (via dbpoweramp)
[15] DONALDO 22 - DONALDO22 (via dbpoweramp)
[0] (Ignore all, not use these tags)

Select match [0-15] (comma/space separated, default 1): 3,12

The following Vorbis comments are inserted:

Key Description Source
title Music/song/sound title CDDB,MusicBrainz
artist Artist name(s) CDDB,MusicBrainz
album Album name CDDB,MusicBrainz
genre Genre CDDB,MusicBrainz
date Date (Non-formal format) CDDB,MusicBrainz
tracknumber Track number internal
tracktotal Number of tracks per this disc internal
albumartist Album artist MusicBrainz
discnumber Disc number (position) MusicBrainz
disctotal Total discs in release MusicBrainz
media Medium format (CD etc.) MusicBrainz
medium Medium title (alias of musicbrainz_mediumtitle) MusicBrainz
releasecountry Release country code MusicBrainz
releasestatus Release status MusicBrainz
label Label name(s) MusicBrainz
catalognumber Catalog number(s) MusicBrainz
isrc ISRC (if present) MusicBrainz
cddb Fetched CDDB server name internal
cddb_date CDDB fetched timestamp (ISO form) internal
cddb_discid CDDB disc ID (Required for re-fetching from CDDB server) internal
cddb_offsets Track start offsets (Required for re-fetching from CDDB server) internal
cddb_total_seconds Disc length in seconds (Required for re-fetching from CDDB server) internal
musicbrainz_release Release MBID (Primary key for MusicBrainz) MusicBrainz
musicbrainz_medium Medium MBID (Primary key for MusicBrainz) MusicBrainz
musicbrainz_mediumtitle Medium title (multi-disc only; falls back to CD n in Vorbis comment when empty) MusicBrainz
musicbrainz_mediumtitle_raw Medium title (raw, format-only; available even for single disc) MusicBrainz
musicbrainz_releasegroupid Release group MBID MusicBrainz
musicbrainz_trackid Track MBID MusicBrainz
musicbrainz_recordingid Recording MBID MusicBrainz
musicbrainz_discid MusicBrainz disc ID (Partial use, will remove when fetch succeed) internal
musicbrainz_leadout MusicBrainz CD leadout time (Partial use, will remove when fetch succeed) internal
discogs_release Discogs release ID (numeric) MusicBrainz

When obtaining information from CDDB or MusicBrainz, not all of this tag information may be available.

Note: There's no need to worry. While Vorbis comments are typically written in uppercase, this document simply uses lowercase.

About MusicBrainz and tags

  • MusicBrainz is a community-maintained music database that provides structured IDs, credits, genres, and release metadata.
  • CDDB servers primarily return text fields like track titles, while MusicBrainz returns precise release-level metadata and stable IDs, improving tagging accuracy.
  • In Scheme CD ripper, simply include musicbrainz in the [cddb] servers list to enable it; it is already included in the default server list.

Cover Art Embedding

When fetching information from MusicBrainz, it additionally attempts to retrieve cover art images. If the player supports cover art display, the cover art image will be shown:

Cover art

  • Fetching and embedding cover art is only possible when a MusicBrainz match is used; other CDDB servers do not supply cover art.
  • You can choose the preference order with -dc/--discogs: always (default: Discogs first, then CAA), fallback (CAA first, then Discogs), no (do not use Discogs).
  • Discogs cover art is only attempted when MusicBrainz release provides discogs_release tag.
  • Cover art is always converted to PNG format. This is because images provided by CAA may contain special metadata (such as ICC profiles), which can cause the hardware media player to be unable to display the image. Since it's in PNG format, the image itself does not degrade over time (though there is a form of “degradation” in the sense that the ICC profile is removed, which performs the color space conversion to sRGB).

Filename formatting

The filename format is a template for any path, including directory names, that uses curly braces to automatically and flexibly determine the path using Vorbis comment key names.

The default is “{album:n/medium:n/tracknumber:02d}_{title:n}.flac”, where directories are created using the album and media title, and files are saved within them with names like “01_foobar.flac”.

Below are the details of this format syntax:

  • Within curly braces {}, you can concatenate multiple keys using / or + to combine any paths or labels:
    • / separates paths, while + joins them with spaces. For example, specifying “{album/medium/title}.flac” separates the album title, media title and music title with a path separator, allowing files to be placed in subdirectories like “foobar/baz/intro.flac”.
    • ex: “{album/medium}” --> “Album/Disc1”
    • ex: "{album+medium}" --> "Album Disc1"
    • If you separate paths outside the brackets, like “{album}/{medium}/{title}.flac”, the path will error if the album and/or medium key doesn't exist. However, if you separate paths inside the brackets, no path separator is added if the key doesn't exist (the same applies to space separation using +).
  • Strings can be converted to safe pathnames using the :n format specifier.
    • Replaces inappropriate path characters with underscores, and if line breaks are present, truncates the string up to that point.
    • ex: “{title:n}.flac”
  • Numbers can have leading zeros interpolated using format specifiers like :02d.
    • This resembles C language printf format specifiers, but only this format is supported.
    • ex: “{tracknumber:02d}.flac” --> “04.flac”

Additionally, it includes the following features:

  • If a directory path is included after formatting, those directories will be created automatically.
  • The .flac extension will be appended automatically if omitted.
  • Scheme CD ripper supports GNOME GIO, allowing you to specify a direct save URL to a remote host (requires GVfs configuration).
    • ex: “smb://nas.yourhome.localdomain/smbshare/music/{title:n}.flac”

Update existing FLACs using embedded CDDB tags

-u/--update lets you refresh metadata on ripped FLACs without the original CD:

# Single file
cdrip -u album/01_track.flac

# Multiple paths (files or directories; directories are searched recursively for *.flac)
cdrip -u album1 album2/track03.flac /path/to/archive

Requirements: FLAC files must contain these tags (These tags are automatically inserted if you rip using the Scheme CD ripper):

  • Re-fetches from CDDB server: cddb_discid, cddb_offsets and cddb_total_seconds.
  • Re-fetches from MusicBrainz (first time): musicbrainz_discid, cddb_offsets and musicbrainz_leadout.
  • Re-fetches from MusicBrainz (not first time): musicbrainz_release and musicbrainz_medium.

CDDB candidates are fetched the same way as during ripping; you still select the desired match interactively (except auto mode.)

Config file format

Scheme CD ripper will refer config file. It is INI-like format.

cdrip.conf (current directory) --> ~/.cdrip.conf: The first file found in this order is loaded. You can also explicitly specify the file using the -i/--input option.

Example config file:

[cdrip]
device=/dev/cdrom
format={album:n/medium:n/tracknumber:02d}_{title:n}.flac
compression=auto     # auto or 0-8
max_width=512        # cover art max width in pixels (> 0)
speed=slow           # slow or fast (default: slow)
aa=true              # show cover art as ANSI/ASCII art (TTY only)
discogs=always       # no / always / fallback (cover art preference order, default: always)
mode=best            # best / fast / default
repeat=false
sort=false
filter_title=         # Filter CDDB candidates by title using regex (empty = no filter, ignore casing)
auto=false

[cddb]
servers=musicbrainz,freedb_japan,gnudb,dbpoweramp   # Comma separated labels

[cddb.gnudb]
label=gnudb
host=gnudb.gnudb.org
port=80
path=/~cddb/cddb.cgi

[cddb.dbpoweramp]
label=dbpoweramp
host=freedb.dbpoweramp.com
port=80
path=/~cddb/cddb.cgi

[cddb.freedb_japan]
label=freedb (japan)
host=freedbtest.dyndns.org
port=80
path=/~cddb/cddb.cgi

Server IDs are defined in the [cddb.<server_id>] section, and queries are made in the order specified under servers in the [cddb] section. If no servers are configured, the built-in three servers (musicbrainz, gnudb, and dbpoweramp) are used.

A special server id musicbrainz is not required [cddb.musicbrainz] section definitions.


Self Building

Dependencies

build.sh:

  • libcdio-paranoia
  • libcddb
  • libFLAC++
  • GNOME GIO
  • libsoup 3.0
  • json-glib
  • libpng
  • libjpeg
  • liblcms 2.0
  • chafa (libchafa)
  • CMake and a C++17 compiler
  • Node.js and screw-up (Automated-versioning tool)

build-package.sh:

  • dpkg-dev (for dpkg-shlibdeps when building packages)
  • cowbuilder (deb package building)

Build

In Ubuntu noble/jammy:

sudo apt-get install build-essential cmake dpkg-dev nodejs \
  libcdio-paranoia-dev libcddb2-dev libflac++-dev libglib2.0-dev libsoup-3.0-dev libjson-glib-dev libchafa-dev libpng-dev libjpeg-dev liblcms2-dev
npm install -g screw-up

./build.sh

Build packages

build_package.sh runs build.sh inside a cowbuilder chroot with qemu-user-static to target one distro/arch per call. Run it repeatedly for all combinations you need.

Prerequisites:

sudo apt-get install cowbuilder qemu-user-static debootstrap systemd-container

Build examples:

# Ubuntu noble / amd64
./build_package.sh --distro ubuntu --release noble --arch x86_64

# Debian bookworm / arm64
./build_package.sh --distro debian --release bookworm --arch arm64

Notes:

  • Arch aliases: x86_64|amd64, i686|i386, armv7|armhf, aarch64|arm64
  • Debug build: add --debug (passes -d to build.sh)
  • Refresh chroot: add --refresh-base
  • Outputs: artifacts/<distro>-<release>-<arch>/*.deb

Batch build for all predefined combos:

# ubuntu noble/jammy × amd64/i386/armhf/arm64
# debian trixie/bookworm × amd64/i386/armhf/arm64
./build_package_all.sh            # reuse existing bases
./build_package_all.sh --refresh-base  # rebuild bases then build all

Note

In this software, "CDDB" does not refer to the terminology of a specific product, but rather to "the CD metadata database."

Discussions and Pull Requests

For discussions, please refer to the GitHub Discussions page. We have currently stopped issue-based discussions.

Pull requests are welcome! Please submit them as diffs against the develop branch and squashed changes before send.

License

Under MIT.

About

Linux CLI tool that rips audio CDs to FLAC instant and continuously, fetches metadata from CDDB and inserts tags and cover images🎵

Topics

Resources

Stars

Watchers

Forks