CDWRITE(8) BSD System Manager's Manual CDWRITE(8)NAME
cdwrite - Write data or audio data to a writable CDROM
SYNOPSIS
cdwrite [general options] [track options] track ...
DESCRIPTION
cdwrite will write data and/or audio tracks to any supported CDR drive.
Currently supported drives include any Philips CDD-522 command set com-
patible drive and the Yamaha CDR-100. HP, Kodak, IMS, and other drives
with the exception of Sony and Yamaha are typically command set compati-
ble with the Philips CDD-522.
The interface to cdwrite is similar to (and therefore possibly familiar
to users of) the cdwrite program shipped with various LINUX distribu-
tions, but only the argument parsing code is actually similar between the
two versions.
cdwrite accepts both normal single-letter options and the longer GNU
style (--foo, dash-dash-foo) options. The general options to cdwrite in-
clude:
-v, --verbose enable verbose output
-s, --speed set the speed for operations. The default speed is
typically the fastest supported speed of the drive: 2,
or double speed for most of the Philips and Philips
compatible drives or 4 (quad speed) for the Yamaha
CDR-100. Attempting to set a speed not supported by
the drive may yield unexpected results.
-y, --dummy set simulation mode. All operations are performed as
normal by the drive, but no data is actually written to
disk. This mode is useful (and recommended) for test-
ing your configuration to ensure that you can keep up
with the desired write speed of the drive.
-e, --eject eject the media from the drive after completing other
operations.
-D, --device dev Use the spefified device instead of the default or the
value specified in the environment variable CDR.
-f, --fixateonly instructs cdwrite to fixate the disk (write the table-
of-contents (TOC), lead-in, and lead-out. Disks must
be `fixated' before they may be used in normal CDROM or
audio CD drives. Once a disk is fixated, no further
tracks may be written. Normally fixation is performed
automatically after writing all the specified tracks.
This behavior can be disabled with the -F or --nofixate
flags.
-F, --nofixate instructs cdwrite to skip the fixation step when it
finishes writing. A future invocation of cdwrite is
needed to write any additional tracks and to fixate the
disk before it may be used in a normal CDROM or audio
CD drive.
--philips Force cdwrite to use the Philips command style to talk
to the drive. Normally cdwrite determines the appro-
priate style to use automatically, but this option may
be useful if new drives are developed which fool the
autodetection code. If you find such a drive which
works correctly when forced, please notify the author
so that it may be included in future releases.
--yamaha like --philips but force Yamaha mode.
--hp like --philips but force HP mode.
In addition to the general options, cdwrite takes several per-track op-
tions:
-b, --bytes NN specifies the amount of data to read/write for this track
in bytes. If no --bytes argument is specified for the
track, the size of audio files will be determined from
the .wav file header in the file and data track size will
be determined by looking in the ISO9660 filesystem struc-
ture. If a data track does not appear to be in ISO9660
format, data will be read/written until EOF of the input
file is reached (or an error occurs).
Unlike the other per-track options, the --bytes option
is valid only for a single track and is reset between
tracks.
-a, --audio Specifies that this track, and future tracks unless over-
ridden by a specific --data flag, consist of audio data
in .wav format.
-d, --data Specifies that this track, and future tracks unless over-
ridden by a specific --audio flag, should be written as
CDROM data. This is the default mode.
-p, --preemp Specifies that this audio track was mastered with preem-
phasis.
-n, --nopreemp Specifies that this audio track was not mastered with
preemphasis (this is the default).
cdwrite assumes (and enforces) that all audio files supplied as input
must be in .wav format with 16-bit stereo samples and sampled at a fre-
quency of 44100 Hz (which is standard red-book CD audio). .wav was cho-
sen because it is commonly available and has a specific byte ordering for
the samples. CDR drives vary in the byte order they expect for audio da-
ta, so a common input format reduces the chances for error. cdwrite will
byte-swap when necessary for a particular type of drive to ensure correct
byte ordering. THIS IS THE MOST SIGNIFICANT INTERFACE CHANGE FROM THE
ORIGINAL LINUX VERSION OF CDWRITE. The sox program may be useful to con-
vert audio files into the appropriate format.
If a cdwrite operation fails due to some error, the drive may be left in
an unknown state, and the drive door may be left locked. If you run
cdwrite without any track arguments, it will restore the drive to a
`sane' state and will release the lock on the door.
GENERAL CDR WRITING GUIDELINES
In general, CD's come in several flavors: data mode disks, audio disks,
and disks which include both data and audio. While there also exist oth-
er formats such as CD-I (mixed mode disks), those formats are not sup-
ported by cdwrite.
CDROM data is usually stored as a single large track at the beginning of
the disk. Most CDROM drives will only let you read data if it resides in
the first track of the disk, so that's usually where you should put it.
Audio CD players will automatically mute the data tracks on disks, so
while it's possible to play CD's with data tracks in standard audio play-
ers, they'll usually be mostly silent. Audio tracks may be appended to
the data track and may be played by seeking past the data tracks on the
disk.
By far the most common problem with writing CD's is data underruns. CDR
drives write `track-at-a-time' and while writing a track, the host com-
puter must keep the CDR drive's buffer from draining completely. If a
write operation terminates due to the buffer draining (underrun), the
write operation cannot be restarted and the resulting disk is unfinished
and unfinishable (known in the vernacular as a `coaster,' as in usable
only to protect a table from the condensation on a cold beverage contain-
er :-). To avoid writing coasters, you will need to have a relatively
idle system with reasonably fast disks. Typically, SCSI disks have much
lower overhead and are thus better suited to supply data to CDR drives.
You should also ensure the system is lightly loaded. cdwrite will renice
itself to priority -20 (the highest priority available on the system)
when it starts up which also helps to mitigate problems. You should ver-
ify that your setup is reasonable by running cdwrite in emulation mode
before attempting to really write a CD.
EXAMPLES
The following command would instruct cdwrite to write the data contained
in the file myiso9660 to the CDR device /dev/rsr1c and to provide verbose
output of what type of drive it believes it's using to execute the opera-
tion and what speed it's using. It will also provide updated status in-
formation as the write proceeds. When all of the data has been written,
the disk will be fixated so that it's ready to use in a normal CDROM
drive:
cdwrite --device /dev/rsr1c --verbose myiso9660
This example shows how you could write three tracks to a disk. The first
track in this case is a CDROM data image (iso9660 format) and the subse-
quent tracks are audio tracks. This example assumes that the either the
default device (/dev/rsr0c) or a device specified by the environment
variable CDR will be used and thus it need not be specified on the com-
mand line:
cdwrite -v myiso9660 --audio track1.wav track2.wav
The following example shows how you could incrementally write tracks to a
disk using multiple invocations of cdwrite. Note that the disk may not be
used in a regular CDROM or audio CD drive until the final fixation step:
cdwrite -v --nofixate myiso9660
cdwrite -v --nofixate -a track2.wav
cdwrite -v --nofixate -a track3.wav
cdwrite -v --fixateonly
ENVIRONMENT
CDR The default device filename. It may be overridden with -D.
DIAGNOSTICS
cdwrite will print a message beginning ``scsi status:'' if a command
fails for some reason. The error message is the actual SCSI sense error
returned by the drive.
SEE ALSOcdr(8), cdread(8), sox(1)HISTORY
cdwrite was derived from scsicmd(8).
AUTHOR
Jeff Polk <polk@BSDI.COM>
BUGS
It would be nice to support disk-at-a-time mode so that it would be pos-
sible to write back-to-back audio tracks without the 2-second delay, but
the mechanisms for doing that appear to be quite different from drive
type to drive type.