CREATE AUDIO CDs USING MPG123 AND CDRECORD

A number of GUI tools exist that you can use to copy audio CDs or take existing MP3 files and convert them to an audio format to burn to a CD. While these GUI tools are great, you can accomplish the same thing using command-line tools, such as cdrecord and mpg123. In some cases, the GUI tools simply act as a front end to these tools.

Using mpg123 and cdrecord together reduces a lot of complexity, and it makes turning MP3 files into audio tracks on a CD simple. For example, to create a CD of four MP3 files (named music1.mp3 through music4.mp3), use the following:

$ mpg123 -cdr -s music1.mp3 | cdrecord -nofix dev=0,0,0 -
$ mpg123 -cdr -s music2.mp3 | cdrecord -nofix dev=0,0,0 -
$ mpg123 -cdr -s music3.mp3 | cdrecord -nofix dev=0,0,0 -
$ mpg123 -cdr -s music4.mp3 | cdrecord -nofix dev=0,0,0 -
$ cdrecord -fix dev=0,0,0

This accomplishes several things. First, we convert an MP3 file to a music file suitable for an audio CD. We then pipe that to cdrecord. We tell cdrecord where to find the CD burner and instruct it to use standard input as the data to write.

We also tell cdrecord not to fixate the disc when finished. Include this step for each file you want to put on the CD. After cdrecord converts all songs and burns them to a CD, we tell it to fixate the disc, which closes the session.

To determine which device to use with cdrecord (e.g., "0,0,0"), use the following:

$ cdrecord -scanbus