Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Multimedia
  • Search

Playing/ripping a CD music disc on Gentoo Linux

Help with creation, editing, or playback of sounds, images, or video. Amarok, audacious, mplayer, grip, cdparanoia and anything else that makes a sound or plays a video.
Post Reply
Advanced search
21 posts • Page 1 of 1
Author
Message
irets
Apprentice
Apprentice
User avatar
Posts: 241
Joined: Tue Dec 17, 2019 12:57 pm

Playing/ripping a CD music disc on Gentoo Linux

  • Quote

Post by irets » Sat Aug 12, 2023 9:27 am

Hi.

I just came home from a record shop with a "new" CD.
I'd like to listen to this on my Gentoo with MPV or MPC but I'm unable to figure out how.

I found old threads on the forums but they use different programs...

How can I listen to this CD with the mentioned programs or rip the CD?
Mounting the CD doesn't seem to work and MPV is unable to start playing the CD from /dev/sr0 and /dev/cdrom.

Thanks.
Last edited by irets on Sat Aug 12, 2023 9:38 am, edited 1 time in total.
Top
irets
Apprentice
Apprentice
User avatar
Posts: 241
Joined: Tue Dec 17, 2019 12:57 pm

  • Quote

Post by irets » Sat Aug 12, 2023 9:34 am

Recompiling MPV with cdda USE-FLAG and running mpv cdda:// plays the CD.

What is "cdda://"?
Why can't I point MPV to /dev/cdrom or /dev/sr0?
How can I rip the CD? I prefer CLI tools.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Aug 12, 2023 11:19 am

Irets,

cdda is Compact Disc Digital Audio.

Music CDs do not have a filesystem, so you can't mount them.
They have a block list that tells the player how to play each track.

The access method is that commands are sent to the drive over its character interface and blocks are returned over its block interface. Hence, you need to be in the cdrom group, to both send commands and read the blocks that are returned.
It's similar to writing blank optical media. That does not have a filesystem (yet) it's blank.

DVD's are similar. They have an iso9960 and sometimes a UDF filesystem too. Both point to the same data. Both are no use at all for playing/ripping the DVD content.
That uses the same method as CDs,

For completeness, Blurays do it (almost) all with the filesystem. Some of the keys are stored outside of the filesystem in a region that BD writers cannot write, so making a bit copy of a BD is not possible.
Well, it could be the blank media that's not writeable at that location.

mplayer can rip both CDs and DVDs.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
steve_v
Guru
Guru
Posts: 445
Joined: Sun Jun 20, 2004 7:39 am
Location: New Zealand

  • Quote

Post by steve_v » Sat Aug 12, 2023 1:20 pm

Irets wrote:How can I rip the CD? I prefer CLI tools.
My pick would be cdparanoia, optionally with whipper as a frontend. Both prioritise accuracy over speed and IME can salvage some pretty nasty disks.
Or abcde. Haven't used that one myself, but it's fairly popular and looks very capable.

FWIW, mpv with the cdda USE flag uses cdparanoia (specifically the cdio-paranoia port) for cdda extraction. You probably already have a cdparanoia binary installed.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Sat Aug 12, 2023 1:57 pm

And if you have a KDE GUI desktop, there's k3b. I think that uses cdparanoia under the covers.
Greybeard
Top
mv
Watchman
Watchman
User avatar
Posts: 6795
Joined: Wed Apr 20, 2005 12:12 pm

  • Quote

Post by mv » Sat Aug 12, 2023 3:43 pm

steve_v wrote:My pick would be cdparanoia, optionally with whipper as a frontend.
cdparanoia is not maintained since ages. I would recommend to use cdrtools (more precisely, the cdrtools version from app-shells/schily-tools from the mv overlay which is much more recent):
The binaries/libraries provided by that use internally cdparanoia (if you specify corresponding command line flags), but the corresponding cdparanoia fork has been maintained for a much longer period.
Unfortunately, the maintainer of cdrtools resp. schily-tools (Joerg Schilling) has decayed, and so there is probably not any version of cdparanoia left which is still maintained, but the newest one which exists is in the mentioned app-shells/schily-tools.
Top
steve_v
Guru
Guru
Posts: 445
Joined: Sun Jun 20, 2004 7:39 am
Location: New Zealand

  • Quote

Post by steve_v » Sat Aug 12, 2023 8:18 pm

mv wrote:cdparanoia is not maintained since ages
Considering that the CD audio format itself has not been "maintained" since ages either and both cdparanoia and libcdio-paranoia continue to function as intended, I fail to see the problem here.
Personally I prefer ports from ::gentoo over overlays in general, unless said port is actually broken. In this case old does not mean broken, at least for the time being.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Top
mv
Watchman
Watchman
User avatar
Posts: 6795
Joined: Wed Apr 20, 2005 12:12 pm

  • Quote

Post by mv » Sat Aug 12, 2023 8:57 pm

steve_v wrote:Considering that the CD audio format itself has not been "maintained" since ages either and both cdparanoia and libcdio-paranoia continue to function as intended
Joerg Schilling used to push regular bugfixes. These were related to new hardware, kernel changes, or just bugs which can occur in some cases. Not having the newest bug fixes is usually a bad idea. For instance, it can mean that cds cannot be read with older versions (or produce some buggy bytes) which after some fixes in timing re-reads or whatever (I am not a hardware expert) can be read successfully.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Aug 12, 2023 9:53 pm

mv,

Or to address new 'copy protection' schemes for CDDA.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
irets
Apprentice
Apprentice
User avatar
Posts: 241
Joined: Tue Dec 17, 2019 12:57 pm

  • Quote

Post by irets » Sun Aug 13, 2023 2:20 am

Thank you for the responses.
I will have to take a look at these various programs and choose which one is the best way for me.

The MPV USE-flag pulls in dev-libs/libcdio-paranoia.

Neddy,
Thank you for the in-depth explanation but what did you mean by this?;
NeddySeagoon wrote:Hence, you need to be in the cdrom group, to both send commands and read the blocks that are returned
My user is not a part of the cdrom group but MPV is able to play the CD by using the method I mentioned in post #2.

Code: Select all

irets@navi ~ $ groups irets
wheel video portage vboxusers plugdev irets
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sun Aug 13, 2023 9:53 am

Irets,

/dev/srX is normally set to

Code: Select all

$ ls -l /dev/sr*
brw-rw---- 1 root cdrom  11, 0 Sep 12  2021 /dev/sr0
brw-rw---- 1 root cdrom  11, 1 Sep 12  2021 /dev/sr1
brw-rw---- 1 root cdrom  11, 2 Sep 21  2021 /dev/sr2
So only root and members of the cdrom group can use the raw block device, which is required to play CDDA.
The corresponding /dev/sgX is normally the same.

The does not apply to reading a filesystem from optical media.
Root performs the mount and you access the filesystem as you normally would.

Its possible that you have some automagic something that makes the raw devices available to your user in a different way.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
soundrolf
Apprentice
Apprentice
Posts: 158
Joined: Thu Sep 08, 2016 3:57 pm
Location: Cologne / Germany

  • Quote

Post by soundrolf » Mon Aug 14, 2023 2:40 pm

Install media-sound/sound-juicer

https://wiki.gnome.org/Apps/SoundJuicer

You can listen your Audio CD
And you can rip the Audio CD
Regards
soundrolf

MOBO: ASUS PRIME B550M-K BIOS 4101 10/16/2025
CPU: AMD Ryzen 9 5900X 12-Core Processor (24) @ 3800 MHz
GPU: AMD Navi 24 [Radeon RX 6400/6500 XT/6500M] driver: amdgpu
RAM: 80GB crucial DDR4 3200 MHz 2x8GB 2x32GB
Top
pa4wdh
Veteran
Veteran
Posts: 1015
Joined: Fri Dec 16, 2005 6:55 pm

  • Quote

Post by pa4wdh » Mon Aug 14, 2023 5:13 pm

To rip audio CD's I use a script i wrote.
It uses cdparanoia to perform the actual ripping, cd-info to read the CD-Text (if available), ffmpeg to do conversion to other audio formats and mp3info to add tags to mp3's.
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Mon Aug 14, 2023 5:26 pm

mp3 is whats left when you throw the music away :)
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
irets
Apprentice
Apprentice
User avatar
Posts: 241
Joined: Tue Dec 17, 2019 12:57 pm

  • Quote

Post by irets » Tue Aug 15, 2023 12:28 am

soundrolf,

I prefer to avoid Gnome software when possible and CLI is for what I'm looking for - no need to complicate it with a GUI.

Neddy,
My permissions match yours but it doesn't look like MPV is able to use /dev/sr* directly anyways.. it prefers cdda://.

Code: Select all

irets@navi ~ $ mpv /dev/sr0
Failed to recognize file format.

Exiting... (Errors when loading file)

irets@navi ~ $ mpv cdda://
[cdda] Switched to track 1
 (+) Audio --aid=1 (pcm_s16le 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch s16
(Paused) A: 00:00:04 / 00:01:35 (5%) Cache: 90s/15MB
The most automagicky thing on my system is probably gvfs (without cdda USE-flag).

IMO ripping a CD to end up with .mp3 is a bit of a waste.
Top
yayo
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 122
Joined: Mon May 19, 2014 12:34 pm

  • Quote

Post by yayo » Fri Aug 18, 2023 2:04 am

If it can help, last time I did it I used this:

Code: Select all

cdda2wav -cddbp-server=gnudb.gnudb.org -cddbp-port=8880 cddb=1 -vall speed=1 -paranoia paraopts=proof -B dev=/dev/sr0
(cdda2wav comes with app-crd/cdrtools)

If I remember correctly -B means "all tracks", but you can read a single track (or a group) too with -t .

paraopts=proof reads the cd many times and makes a verify out of the result.
If it fails (=ruined cd) you can try to read a single track many times with paraopts=disable,c2check and/or test the result files manually with a checksum.

The cddb options are for online query about the cd info, to save tracks with proper name, while speed=1 will probably fall to the slowest speed of your cd reader.
Top
Anon-E-moose
Watchman
Watchman
User avatar
Posts: 6566
Joined: Fri May 23, 2008 7:31 pm
Location: Dallas area

  • Quote

Post by Anon-E-moose » Fri Aug 18, 2023 1:20 pm

I've always used abcde for my uses.
With the right flags it will convert to many formats, read cdda info and tag out files (if format allows), either whole album or selected tracks.
UM780 xtx, 6.18 zen kernel, gcc 15, openrc, wayland
minixforum m1-s1 max -- same software as above but used for ai learning


Zealots are gonna be zealots, just like haters are gonna be haters
Top
irets
Apprentice
Apprentice
User avatar
Posts: 241
Joined: Tue Dec 17, 2019 12:57 pm

  • Quote

Post by irets » Sat Aug 19, 2023 3:31 am

yayo,

I should have mentioned this ealier but I want to preserve the original quality as much as possible ie. rip lossless audio files off from the disc.
AFAIK .flac is the way to go. Correct me if I'm wrong.

cdda2wav sounds like it makes .wav format files off from a CD.
Thank for the example nevertheless - ripping CDs is new to me.

If we are being precise, are .flac files a "true" copy of a CD? or does something get lost in the process no matter what?

abcde seems very featureful.
I'll have a look at the docs.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56082
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Sat Aug 19, 2023 10:46 am

Irets,

The tracks on CDDA are wav. The format in the same as a wav file.

Most ripping software gets the tracks to separate *.wav files and post processes them as a separate step.
I play CDs exactly once. To rip them to .flac, which as you say, is lossless.

Something like cdparanoia is essential as real CD players 'hide' read errors by making up the missing data if its too much for the error recovery, so you don't hear it.
Computer optical drives don't do that. They either read the CD or not.
Some CD copy protection triggers this 'making up data' process deliberately, so CD coping fails as the CD cannot normally be read.

cdparanoia does lots of repeated reads of damaged blocks (deliberately corrupt or not) and uses what it can recover, to fill in.
Yes, some CDDA are deliberately corrupt when they are made. They won't play on an original early CD player either.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
yayo
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 122
Joined: Mon May 19, 2014 12:34 pm

  • Quote

Post by yayo » Sat Aug 19, 2023 9:22 pm

Yes, as NeddySeagoon said, CD data are wav data, so extracting the tracks as wav files is ok.
Softwares that extract CD to flac (or whatever), just get the wav data internally, compress it and save it to the desired format.

Cdparanoia is a library that reads the CD twice (or more) to make a comparison searching for errors, so once you get an output with all 0% errors you can be sure you got a perfect copy.

Flac means "free lossless audio codec": it's an audio file format that compress the wav data as much as possible without losing a single bit (roughly around 60% of the original file).
By decompressing the flac you get exactly the wav file you started with.


So cdda2wav is a good choice, it will give you verified CD tracks. : )
Any kind of compression (flac too) can be done later manually, as a separate step.

The only one thing I cannot help with is what mv said on his post about the app-shells/schily-tools from the mv overlay, with a mantained cdparanoia fork. I never tried it.
Maybe that's a better choice for new cd with whatever kind of new copyprotection "bugs"...? I have no idea...

Try both. : )
Top
Spanik
Veteran
Veteran
Posts: 1170
Joined: Fri Dec 12, 2003 9:10 pm
Location: Belgium

  • Quote

Post by Spanik » Sat Aug 26, 2023 8:09 am

Bit late to the thread.

I use Audex for ripping now. It is so far the only one I found that manages to use accents in titles and make files with it. If you listen to music outside the common anglosaksian world it can be necessary. It has a couple of faults (is it is a multi-artist cd and you change some of the data manually then it still uses the data it gets from cddb) and you have to remember to switch from single artist to multi-artist manually. But I take that over the mess I had with accents in the titles before. Audax uses cdparanoia.

As for format, I keep everything in .wav. Storage is cheap these days. Have about 1000 of my cd's ripped now and this isn't even a whole TB.

So far I have encountered 1 defective cd that could not be read (and it is not one of the oldest). But a cd player doesn't read it either. Other cd's have a few tracks that have unrecoverable errors giving noise at playback. Those I just play with a cd player and record the digital output with something like Audacity. Not having the ability to "fill in the errors" can be an issue at times.
Expert in non-working solutions
Top
Post Reply

21 posts • Page 1 of 1

Return to “Multimedia”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic