Saturday, March 31, 2007

Linux CD/DVD Recording

Linux CD/DVD Recording

Thursday November 18, 2004 (08:00 AM GMT)

By: Ola Eriksson

Modified by : Connie Sieh

December 2004

This is an introduction to using CD and DVD recorders under Linux and UNIX systems. Its main focus is on command line based tools. It will give you an idea how the powerful tools and utilities behind the fancy GUIs work and what they can do for you. Recording CDs and DVDs from the command line can be useful in many situations, for example if you access to the host only via the network; if your host does not have X11 available; or perhaps your favorite GUI won't start for some reason. Another reason for using the command line based tools is that they can be used in scripts to automate repetitive tasks such as backups.

Software

To create images and record them onto a CD/DVD, we need to have some programs available on our system. All programs used in this guide are open source, released under licenses that make them free to download and use. Please make sure that you have all of these programs installed and working before you continue reading this guide.

Note: Many Linux distributions have many or even all or these programs installed in the default installation, so make sure that you don't have them installed already before spending time downloading and compiling the packages listed below.

WORKING WITH CD'S
  • cdrecord

    Creating ISO images

    Mkisofs from cdrtools can pre-master ISO images so they can be written to CDs at a later time. Mkisofs has a large set of options available, but we will only use the most common ones to create a normal mage. For more details on the accepted options, please see the manpage.

    Syntax:

    mkisofs -o image.iso -J -r /path/to/data/

    -o Output file

    -J This will create an image using Joliet file naming, Useful for Windows . Allows for longer thatn 8.3 file names

    -r Rock Ridge (-r) extensions. Unix version of allowing for longer filenames. This standard has been around for a long time.

    Creates ISO9660 filesystem

    Example:

    root@linux:~# mkisofs -o mycd.iso -J -r /a/data/ Working with CDs

    Note that DVD recorders can be used to record data to normal CD-R(W) discs too, not just DVDs. This part will cover the basics of recording files and images to CD-R(W) discs.

    Determining devices for cdrecord

    We provide cdrecord with an option that specifies which device it should use when performing the requested actions. (recording, reading etc) This is done with the --device argument. Depending on your system and setup, you will need to address the recorder in different ways. The format for the --device argument is: [prot:]bus,id .

    This is because of atapi cd record devices using a translation from atapi to scsi. This was done originally because all of the original cdreorders were scsi. Thus all the programs that communucated with them were written expecting a scsi device.

    Newer versions of cdrecord allow for native ATAPI support . With the device entry of the form ATAPI:0,1,0 or ATA:0,1,0.

    To find out how to address your recorder, cdrecord offers a scanbus argument, that will try to find all available recorders and CD players connected to your system, and display them along with their bus id. To scan for devices, simply execute cdrecrord --scanbus.

    Example:

    From the example below, we see that our recorder should be addressed as ATA:1,0,0.

    root@linux:~#cdrecord --scanbus

    Using libscg version 'schily-0.8'

    1,0,0 _NEC ,DVD_RW ND-3500AG, 2.1 root@linux:~#

    Note: In our examples, we will use device 0,1,0, which you should replace with the identifier for your recorder.

    Recording ISO image to CD

    Recording an image from iso image using cdrecord is rather straight forward. Just issue cdrecord with the iso image name along with cdrecord options.

    Syntax:

    cdrecord –dev=0,1,0 -speed=10 –eject -v something.iso

    There are also some common options that might be useful: --speed <speed> Force a given write-speed. --eject CDRECORD will eject the CD after it's finished writing to it.

    -v Verbose messages

    Example:

    root@linux:~# cdrecord -dev=0,1,0 -speed=10 -eject something.iso

    Making ISO images from CDs

    The creation of ISO-images from CDs is done in the same way as for DVDs, using the readcd. Syntax:

    readcd dev=device f=image

    This example will make an image named mycd.raw from the disc inserted into device addressed at ATAPI:0,1,0:

    root@linux:~# readcd dev=ATAPI:0,1,0 f=mycd.raw

    Erasing a CD-RW disc

    Erasing a CD-RW disc with cdrecord is pretty straight forward, all needed is to issue it's 'blank' option, followed by information on what drive to erase the media in, using the --device option.

    Can include this on the normal burn line.

    Sometimes cdrecord will be unable to blank your media at the drivers default speed, if this is the case, you can force it to use a lower speed with the --speed option. (Example: --speed 10)

    Example:

    root@linux:~# cdrecord –blank=fast –device=0,1,0 -speed=10 something.iso

    Working with DVDs

    Below are descriptions of how to do the more common tasks related to recording of DVDs.

    Note on + and - medias

    Today most DVD recorders support both DVD-R(W) and DVD+R(W) medias, and even though this guide refers to DVD-R(W) discs the same instructions could just as well be used with DVD+R discs.

    Dvdrecord

    Dvdrecord is a fork of cdrecord which is part of the cdrtools package. Modifications were added to support writing to dvd-r/rw .

    DVD+RW-Tools

    This is a package containing tools used when working with DVDs and images. In this guide, we will focus on the growisofs-application provided with this package. However, it does also provide a utility that erases DVD-RW discs (dvd+rw-format) that we will use for this purpose. http://fy.chalmers.se/~appro/linux/DVD+RW/

    Determinng devices for dvd+RW tools

    Growisofs has a different way of addressing it's recording-device. It uses a UNIX-path to a device under /dev that is connected to the recorder. For more information on how to locate the path to use for your recorder, please see the setup-notes for DVD-recorders/readers for your particular system and distribution.

    Note: On some systems, a softlink named /dev/dvd will be set up at installation to point to your DVD-reader/writer if available, so this could be a good place to start.

    Note: In this guide, we will use /dev/dvd whenever a device needs to be specified when recording DVDs. If this does not work on your system, please replace it with the appropriate path for your system in all examples related to DVD-recording.

    Recording a DVD image

    To record an image to a DVD-R disc, we will use the growisofs software. To do this, we run growisofs with a set of arguments instructing it about our intentions. We execute growisofs with the following syntax:

    growisofs -Z /dev/dvd=image

    -Z ZERO time used for this media.

    Example: The example below shows how to record the image 'mydvd.img' to a DVD-R(W) disc.

    root@linux:~# growisofs -Z /dev/dvd=mydvd.img

    Storing files on a DVD disc

    DVDs can be used to store files in the same way as ordinary CDs, with the major difference that DVDs can store quite a lot more data. DVDs even use the same filesystem (ISO9660) with the same common extensions (Joliet and Rock Ridge) as normal CDs.

    Growisofs offers an easy way to store a set of directories and/or files on a DVD. It uses mkisofs to create an image, and writes it to the DVD recorder without needing to store a copy of the image on the harddrive before recording it.

    For example:

    growisofs -Z /dev/dvd -J -R /path/to/disc/root

    -J Joliet file naming

    -R Rock Ridge Unix naming allowed

    Note that these are really options to mkisofs.

    Blanking DVD-RW discs

    Working with rewritable media is no different from working with ordinary DVD-R media aside from the obvious fact that every now and then you may want to erase the data on them and start over. From the DVD+RW-Tools package we get the dvd+rw-format command that does this for us. It has two modes that can be used when erasing discs, either quick or full mode. In most cases, a quick erase is enough, and this will only take a minute or two (depending on your recorder), compared to the full-erase mode, that takes about the same time as writing a full-size to the media. (Or even longer, depending on the recorder you are using)

    To perform a quick format, issue the following command:

    dvd+rw-format -blank /dev/dvd

    And here is the syntax for erasing the entire disc:

    dvd+rw-format -blank=full /dev/dvd

    Master and record a DVD Video image

    In some cases, you might have a Video DVD stored as a series of normal files in your filesystem, perhaps from some DVD authoring software, and want to write this to a disc for usage in your DVD-player.

    To do this, we yet again turn to growisofs for help, which as usual provides an easy solution to our problem.

    In the example below, the disc-root refers to a directory containing any, or both of the AUDIO_TS/ and VIDEO_TS/ directories. The main difference from writing an ISO image is the -dvd-video option, that instructs growisofs that it should prepare the disc to be used as a DVD Video disc.

    growisofs -Z /dev/dvd -dvd-video /path/to/disc/root

    Below is a sample listing of what the filestructure of a Video DVD might look like:

    AUDIO_TS/ VIDEO_TS/ VIDEO_TS/VIDEO_TS.BUP VIDEO_TS/VIDEO_TS.IFO VIDEO_TS/VIDEO_TS.VOB VIDEO_TS/VTS_01_0.BUP VIDEO_TS/VTS_01_0.IFO VIDEO_TS/VTS_01_0.VOB VIDEO_TS/VTS_01_1.VOB ...

    Making image from a DVD

    Sometimes you might need to create an ISO image from an existing DVD disc. To do this, we use the readcd-tool provided with cdrtools. Readcd can also be used to make images from normal CDs.

    Syntax:

    readcd dev=device f=image

    The device is given in the same was as when using cdrdao. For more options, please see the manpage for readcd.

    This example will make an image named mydvd.raw from the disc inserted into device addressed at ATAPI:0,1,0:

    root@linux:~# readcd dev=ATAPI:0,1,0 f=mydvd.raw

    CCD and NRG images

    You may run into .nrg- or .ccd images that you wish to write to a CD. This can be quite tricky in the Linux/Unix-world, since none of the programs available today have support for this. Currently, the only way to do this is to convert them to ISO images first. To do this, there are two small utilities available, nrg2iso and ccd2iso.

    Although these two tools do their best to convert NRG and CCD images to ISOs, there is no guarantee that the resulting images will be fully usable since the ISO-image format does not support all the features used by NRG and CCD images.

    NRG2ISO

    Nrg2iso will convert Nero image files to ISO files. If it is not provided with your installation, it can be downloaded from: http://gregory.kokanosky.free.fr/v4/linux/nrg2iso.en.html

    Usage: nrg2iso image.nrg image.iso

    CCD2ISO

    CloneCD images can be converted into ISO's with ccd2iso, that can be downloaded from: http://ccd2iso.sourceforge.net/

    Usage: ccd2iso [.img filename] [.iso filename]

    Converting video-files to (S)VCD

    Sometimes you might have a set of MPEG streams from which you would like to create a (Super) VideoCD (SVCD or VCD) to be recorded with CDRDAO and used in your VCD/DVD-player. To do this, we will use the GNU VCDImager software.

    Use the following syntax for VCDImager to create a set of bin/cue-files from an MPEG stream. Replace “type” with the appropriate type for the output image, based on the type MPEG-stream you are recording. The more common types are 'vcd' for mpeg1-streams, and 'svcd' for mpeg2-streams. VCDImager will notify you if it believes that you have selected the wrong type for the given stream.

    Syntax: vcdimager -t type --update-scan-offsets video.mpg

    The following example will create a bin/cue-image in SuperVCD format, containing the stream found in myshow.mpg. (That in this case is an MPEG2 stream)

    root@linux:~# vcdimager -t svcd --update-scan-offset myshow.mpg

    The MPEG streams needs to be in somewhat appropriate formats to be used as (S)VCDs, but this is beyond the scope of this guide. There is more information about this on VCDImager's website. (See the “Software” section)

    Graphical User Interfaces (GUIs)

    Over the years, more and more graphical frontends for various terminal-based CD/DVD recording programs have appeared. Many of these provides great features and really make things easier when performing basic tasks. Here we will mention a few of the best-known GUIs for CD and DVD recording, along with links to more information about them.

    X-CD-Roast

    This is one of the oldest programs in this category. It has been around for quite some time now, and offers a good set of functions without being hard or complex to use. X-CD-Roast is a frontend for the tools found in the cdrtools-package.
  • http://www.xcdroast.org

  • K3B (CD/DVD Kreator for KDE)

    K3B is a nice-looking CD and DVD creator

    Gnome Nautili

  • © Copyright 2004 - OSTG, Inc., All Rights Reserved