[Techtalk] understanding cdrecord

Alvin Goats agoats at compuserve.com
Mon Nov 4 01:56:35 EST 2002


> So I've read the man page, but I am afraid I am the none the wiser as to how to
> burn my .iso image.


What kind of "iso" image are you trying to burn? Music, data?


Regardless, I recommend that you get one of those little hardbound
journals and keep all the little bits and pieces of knowledge you pick
up in it. It really helps when you try to do something again after a
while.

Now, from my little journal:

DATA CD's:

mkisofs -R -o /tmp/image.raw /directory-tree-to-be-burned

-R generates SUSP and RockRidge records using the Rock Ridge protocol.
-o /tmp/image.raw  makes the output file named image.raw in directory
/tmp


This makes the iso9660 image file that you will burn on the CD. To burn
this image on the CD:

cdrecord -v -eject -multi -speed=4 dev=2,0 driver=mmc_cdr /tmp/image.raw

-v verbose output, so if an error occurs you can get some intelligent
reason why. It also gives better status of what cdrecord is doing at
this moment.

-eject will eject the cdrom after the burn is complete

-multi sets the cdrom for multisession recording, in case you want to
add more data later

-speed=4 sets the record speed to 4x. If you have a faster drive, use a
faster number. If you are having trouble burning CD's, use a lower
number. For a lot of drives, speed=4 will burn low quality CDROMs, but
if you still have trouble, then speed=2 and lastly, speed=1 to burn a
CD. It it won't work at norma, 4x, 2x or 1x speed, clean the drive,
check the cables and check the disks. 

dev=2,0 sets the device or burner to SCSI ID 2, lun 0. Depending on how
your drive is interpreted by your distribution, you might be able to use
dev=/dev/cdrom, dev=/dev/srX or dev=/dev/sgX where X is the drive (in my
case X=2).

driver=mmc_cdr  says to use driver mmc_cdr. If you don't know which
driver to use, then do this:

cdrecord -checkdrive

The output will look something like:

Cdrecord 1.8.1 (i686-pc-linux-gnu) Copyright (C) 1995-2000 Jörg
Schilling
TOC Type: 1 = CD-ROM
scsidev: '2,0'
scsibus: 0 target: 2 lun: 0
Using libscg version 'schily-0.1'
atapi: 0
Device type    : Removable CD-ROM
Version        : 2
Response Format: 2
Capabilities   : 
Vendor_info    : 'YAMAHA  '
Identifikation : 'CRW4260         '
Revision       : '1.0q'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO
Drive buf size : 1176000 = 1148 KB


This is probably the most universal and easiest way to get your data CD
burned. The iso9660 Rock Ridge CD is reabable by unix, linux, apple,
microsoft and OS/2.



MUSIC CD's:

cdrecord wants .wav files, so let's start with how to get the right
format sound:


Not all .wav files are alike, and cdrecord needs them in specific
formats. The easiest way to do this is with sox:

sox song.wav song.cdr

which takes the .wav file 'song' and converts it to a CD compatable
image. This takes care of all those issues of trying to set the rate,
mono/stereo and other things. We only want to make it simple, quick and
dirty.

Next:

rm song.wav
sox song.cdr song.wav
rm song.cdr

deletes the file song.wav, converts song.cdr to the proper wav file for
cdrecord and then deletes song.cdr to conserve disk space.



If you have mp3 files you want to burn, then you have to convert them to
.wav as well. I use mpg123 so the command to do the conversion is:


mpg123 -b 10000 -s song.mp3 | sox -t raw -r 44100 -s -w -c 2 - song.wav

This makes mpg123 send the output data to sox in a format sox can work
with. sox then converts the data and writes the file song.wav. We also
avoided all the junk after sox previously by making song.cdr. However,
here, you HAVE to do it the hard way! :(

And NOTE: it is -c 2 - filename. There really is that extra dash with
nothing after it! *I* don't know why, but it WON'T work without it! :)


Now that all of your .wav files are in the correct format, they may not
have the correct number of bytes to fill out the sector on a music CD.
This is where -pad comes in; it adds zeroes to fill in the sector,
'padding' the sector with useless data. 

SO, to write the music CD:

cdrecord -v -eject -pad -speed=4 dev=/dev/cdrom driver=mmc_cdr *.wav

which will record one track per wav file. You are limited to 99 tracks,
so watch it if you are recording sound effects.


RIPPING/COPYING:

First, if you have 2 CD drives, see if you can do the following:

cdrecord -v -eject -speed=4 dev=/dev/cdrom driver=mmc_cdr
/dev/YourOtherCD

If it works, great! Otherwise:


Rip the CD. I use cdda2wav, so:


cdda2wav -v255 -D0,2,0 -A/dev/sr0 -s -B

which writes all of the tracks on the CD to the current directory.

cdda2wav -v255 -D0,2,0 -A/dev/sr0 -s -t XX -w

will rip track number XX (-t XX) and output a wav file. You WILL have to
rename the outputted files. 


Once the data is ready, it works best if you have a drive that is
disk-at-once compatable:

cdrecord -v -eject -dao -useinfo -speed=4 dev=/dev/cdrom driver=mmc_cdr
*.wav

-dao does disk at once
-useinfo will use the information files created by cdda2wav in writing
the music CD


If you aren't so lucky to have a disk-at-once compatable burner, leave
off the -dao command
and try that. If that doesn't work, then drop the -useinfo as well. I
have to use the later for my old Yamaha CDR100 burner.


This should get you operational for most things people want to do with
CD burners. Everything else is just added capabilities most people don't
use or won't use very often.

Alvin



More information about the Techtalk mailing list