Ripping Your CD Collection to FLAC on Manjaro Linux With One Command
I've recently been setting up my Manjaro Linux PC so I can start ripping some of my original CDs to FLAC.
The aim was to keep it simple: insert a CD, type one command, get the correct artist/album/track information automatically, and end up with properly tagged lossless FLAC files.
After a bit of setting up and testing, I've now got it working reliably.
Hardware
I'm using an external USB CD/DVD drive. Linux detects it as:
/dev/sr0
You can check yours with:
lsblk
Installing abcde
I'm using abcde (A Better CD Encoder) to handle the ripping.
On Manjaro it wasn't available from my normal repositories, so I installed it from the AUR using:
pamac build abcde
I also needed these packages for CD identification and MusicBrainz metadata:
pamac build cd-discid
pamac build perl-musicbrainz-discid
pamac build perl-webservice-musicbrainz
Configuring abcde for FLAC
I created:
~/.abcde.conf
with:
CDROM=/dev/sr0
# Rip to FLAC
OUTPUTTYPE=flac
# Finished albums go here
OUTPUTDIR="$HOME/CD-Rips"
# Get artist, album and track information from MusicBrainz
CDDBMETHOD=musicbrainz
# Artist/Album/Track - Title
OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} - ${TRACKFILE}'
# Keep spaces in filenames
mungefilename ()
{
echo "$@" | sed 's|/|-|g'
}
That gives me a folder structure such as:
~/CD-Rips/
└── M People/
└── Bizarre Fruit/
├── 01 - Sight for Sore Eyes.flac
├── 02 - Search for the Hero.flac
├── 03 - Open Your Heart.flac
...
└── 10 - And Finally....flac
Making It a One-Command Job
I created:
~/bin/rip-cd
containing:
#!/bin/bash
abcde -d /dev/sr0
and made it executable:
chmod +x ~/bin/rip-cd
Assuming ~/bin is in your PATH, ripping a CD is now simply:
rip-cd
abcde reads the disc and searches MusicBrainz. If several releases match, it lets you choose the correct one.
It may then ask:
Edit selected CDDB data [Y/n]?
I normally answer:
n
It also asks whether the CD is multi-artist. For a normal album by one artist, that's also:
n
A compilation containing tracks from different artists would be different.
Then I just leave it alone while it rips and encodes the CD.
Checking the Finished FLAC Files
I don't want to assume a rip is good just because it completed.
FLAC has a built-in integrity test. For example:
flac -t ~/CD-Rips/"M People"/"Bizarre Fruit"/*.flac
My second test CD produced:
01 - Sight for Sore Eyes.flac: ok
02 - Search for the Hero.flac: ok
03 - Open Your Heart.flac: ok
04 - Love Rendezvous.flac: ok
05 - Precious Pearl.flac: ok
06 - Sugar Town.flac: ok
07 - Walk Away.flac: ok
08 - Drive Time.flac: ok
09 - Padlock.flac: ok
10 - And Finally....flac: ok
So every FLAC could be decoded without an error.
Tested With Two CDs
I've now successfully tested the setup with:
R.E.M. — Out of Time
11 tracks ripped, tagged and all 11 passed the FLAC integrity test.
M People — Bizarre Fruit
10 tracks ripped, tagged and all 10 passed the FLAC integrity test.
So it wasn't just a case of getting lucky with one disc.
Copying the Finished Album to My Music Server
My main music collection is on a 2 TB USB hard drive attached to a Raspberry Pi 5.
Once I've verified a rip, I can copy it directly from Manjaro to the Pi over SSH. For example:
scp -r ~/CD-Rips/"M People" pimusic@kiosk2:/mnt/flacmusic/Music/
I then test the copy on the Pi as well:
ssh pimusic@kiosk2 'flac -t /mnt/flacmusic/Music/"M People"/"Bizarre Fruit"/*.flac'
Only when those files report ok do I know that both the original rip and the transferred copy are good.
Final Workflow
After all the initial setup, the actual ripping process is now basically:
Insert CD
↓
rip-cd
↓
Choose the correct MusicBrainz release
↓
Wait for the rip to finish
↓
Run flac -t
↓
Copy to music storage
↓
Verify the copied FLAC files
It's turned what initially looked like quite a complicated Linux job into something very straightforward.
I've recently been setting up my Manjaro Linux PC so I can start ripping some of my original CDs to FLAC.
The aim was to keep it simple: insert a CD, type one command, get the correct artist/album/track information automatically, and end up with properly tagged lossless FLAC files.
After a bit of setting up and testing, I've now got it working reliably.
Hardware
I'm using an external USB CD/DVD drive. Linux detects it as:
/dev/sr0
You can check yours with:
lsblk
Installing abcde
I'm using abcde (A Better CD Encoder) to handle the ripping.
On Manjaro it wasn't available from my normal repositories, so I installed it from the AUR using:
pamac build abcde
I also needed these packages for CD identification and MusicBrainz metadata:
pamac build cd-discid
pamac build perl-musicbrainz-discid
pamac build perl-webservice-musicbrainz
Configuring abcde for FLAC
I created:
~/.abcde.conf
with:
CDROM=/dev/sr0
# Rip to FLAC
OUTPUTTYPE=flac
# Finished albums go here
OUTPUTDIR="$HOME/CD-Rips"
# Get artist, album and track information from MusicBrainz
CDDBMETHOD=musicbrainz
# Artist/Album/Track - Title
OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM} - ${TRACKFILE}'
# Keep spaces in filenames
mungefilename ()
{
echo "$@" | sed 's|/|-|g'
}
That gives me a folder structure such as:
~/CD-Rips/
└── M People/
└── Bizarre Fruit/
├── 01 - Sight for Sore Eyes.flac
├── 02 - Search for the Hero.flac
├── 03 - Open Your Heart.flac
...
└── 10 - And Finally....flac
Making It a One-Command Job
I created:
~/bin/rip-cd
containing:
#!/bin/bash
abcde -d /dev/sr0
and made it executable:
chmod +x ~/bin/rip-cd
Assuming ~/bin is in your PATH, ripping a CD is now simply:
rip-cd
abcde reads the disc and searches MusicBrainz. If several releases match, it lets you choose the correct one.
It may then ask:
Edit selected CDDB data [Y/n]?
I normally answer:
n
It also asks whether the CD is multi-artist. For a normal album by one artist, that's also:
n
A compilation containing tracks from different artists would be different.
Then I just leave it alone while it rips and encodes the CD.
Checking the Finished FLAC Files
I don't want to assume a rip is good just because it completed.
FLAC has a built-in integrity test. For example:
flac -t ~/CD-Rips/"M People"/"Bizarre Fruit"/*.flac
My second test CD produced:
01 - Sight for Sore Eyes.flac: ok
02 - Search for the Hero.flac: ok
03 - Open Your Heart.flac: ok
04 - Love Rendezvous.flac: ok
05 - Precious Pearl.flac: ok
06 - Sugar Town.flac: ok
07 - Walk Away.flac: ok
08 - Drive Time.flac: ok
09 - Padlock.flac: ok
10 - And Finally....flac: ok
So every FLAC could be decoded without an error.
Tested With Two CDs
I've now successfully tested the setup with:
R.E.M. — Out of Time
11 tracks ripped, tagged and all 11 passed the FLAC integrity test.
M People — Bizarre Fruit
10 tracks ripped, tagged and all 10 passed the FLAC integrity test.
So it wasn't just a case of getting lucky with one disc.
Copying the Finished Album to My Music Server
My main music collection is on a 2 TB USB hard drive attached to a Raspberry Pi 5.
Once I've verified a rip, I can copy it directly from Manjaro to the Pi over SSH. For example:
scp -r ~/CD-Rips/"M People" pimusic@kiosk2:/mnt/flacmusic/Music/
I then test the copy on the Pi as well:
ssh pimusic@kiosk2 'flac -t /mnt/flacmusic/Music/"M People"/"Bizarre Fruit"/*.flac'
Only when those files report ok do I know that both the original rip and the transferred copy are good.
Final Workflow
After all the initial setup, the actual ripping process is now basically:
Insert CD
↓
rip-cd
↓
Choose the correct MusicBrainz release
↓
Wait for the rip to finish
↓
Run flac -t
↓
Copy to music storage
↓
Verify the copied FLAC files
It's turned what initially looked like quite a complicated Linux job into something very straightforward.