Tagged: cdrecord

Rip Music CD to flac, and More

Here is a list of commands to rip music CDs to flac, convert to mp3, and create a music CD.

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Ripping Music CD to flac:

# emerge --ask media-sound/abcde $ cp /etc/abcde.conf ~/.abcde.conf $ cp ~/.abcde.conf ========== ... FLACENCODERSYNTAX=flac FLACOPTS='-s -e -V -8' OUTPUTTYPE=flac ... $ abcde -o flac

Convert flac to mp3:

Here is a script or command line to convert flac files to mp3 using ffmpeg.$ for a in ./*.flac; do > < /dev/null ffmpeg -i "$a" -qscale:a 0 "${a[@]/%flac/mp3}" > done

Create Music CD:

To create a music CD from command line, we need a bit of preparation. If you need to normalize the volume of output files, you'd need to install media-sound/normalize.# emerge --ask media-sound/normalize

This will convert all files in the current directory to .wav files. I usually copy needed flac or mp3 files to /tmp and run these commands.$ for i in $( ls ); do ffmpeg -i $i $i.wav; done $ normalize -m *.wav $ cdrecord -v -fix -eject dev='/dev/sr0' -audio -pad *.wav

ffmpeg
  • -i INPUT: INPUT file(s)

normalize
  • -m: Enable mix mode
  • (-b: Enable batch mode)

cdrecord
  • -v: Increment the level of general verbosity by one
  • -fix: The disk will only be fixated
  • -eject: Eject disk after doing the work
  • dev=TARGET:Set the SCSI TARGET for the CD/DVD/Blu‐Ray-recorder
  • -audio: All subsequent tracks are written in CD-DA audio format
  • -pad: If the track is a data track, 15 sectors of zeroed data will be added to the end of this and each subsequent data track.

In case file names contain spaces, replace them with "_" (or something valid) before executing above commands.$ for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done

That's all!
-gibb