RSS .92| RSS 2.0| ATOM 0.3
  • Inicio
  •  

    CDxfs

    Linux Notes: CD Ripping, Recording, and Mastering

    Audio CDs

    Ripping

    "Ripping" means transfering an audio track from an audio CD to the hard drive. This is challenging because the OS cannot receive the audio data in real time, and repositioning the laser accurately is difficult. The CD format was designed for real time streaming access, not random access.

    To rip audio tracks, use cdparanoia

    Reading the cdparanoia animated output: spaces and happy faces are good, a dash is acceptable.

    To rip an entire ISO filesystem from a CD-ROM:


    dd if=/dev/cdrom of=my_cdrom.iso


    Warning!

    When burning a multi-session audio or data CD, disable auto-mounting. If enabled, the OS will try to both read and write to the CD at the same time, and will cause either a miswrite or will deadlock the kernel. See: Nautilus > Peripherals > CD Properties > (Audio CD > Auto-play) and (Data CD > Auto-mount).


    General Hints


    Media Write Speeds

    Media speeds for my CD writer, Plextor 16/10/40A:



    Imation CD-R 24x speed=16
    Memorex CD-RW 4x speed=4


    Burning a Data CD

    Gnome Desktop, xcdroast, and other provide a handy means to create data CDs. Gnome’s is the easiest to use though provides the least control — perfect for a quick job. In the Gnome File Browser, select Go > CD/DVD Creator.

    1. Assemble data into a single directory tree.
    2. Create an ISO image with:
         mkisofs -o cd.iso -R -J -r dir
      Other options:
         -f   Follow symbolic links
    3. Verify/browse ISO image with:
         isoinfo -i cd.iso -f -R -J  | less
      Or mount as a read-only file system with:
         mount cd.iso /mnt/dir -t iso9660 -o ro,loop
      (if you get a complaint about "loop unknown", try running modprobe loop; see
      Gentoo Kernel, Block Devices).
    4. Write CD with:
         cdrecord -v speed=16 dev=0,0,0 -data cd.iso

    Use:

    Run cdrecord -scanbus to determine the CD drive device parameters.
    Use the "-dummy" option to test the settings.

    For DVDs, see Writing to DVD media.

    A script fragment to help manage ISO contents (where "cd" is the directory with the contents):

    if [ ! -e mixed_mode.iso -o -n "`find cd -newer mixed_mode.iso`" ]; then    echo "Cleaning..."    find cd \( -name '*~' -o -name '*.bak' -o -type d -name '.*' -prune \) \         -print -exec rm -rf '{}' \;    echo    echo "Link check..."    html_link_check -start cd/READ-ME.html    echo    echo "Building ISO image..."    mkisofs -o mixed_mode.iso -R -J -r cd    echo    echo "Contents:"    isoinfo -i mixed_mode.iso -f -R -J    echofi

    Reading non-iso9660 CDs

    Sometimes well-meaning friends send non-iso9660 data CDs. Linux can’t read them. For example, a friend created a data CD on a Macintosh with the HFS file system rather than iso9660. To read the data anyway:

    1. Copy the raw CD contents to the hard disk:
          dd if=/dev/cdrom of=cd.iso
    2. Mount as a loopback  device:
          mount cd.iso /mnt/dir -t hfs -o ro,loop

    (Maybe this is excessive. Experiment with mounting the CD as HFS rather than the default ISO9660 file system.)

    Downloading and Burning ISO images from RedHat

    RedHat distributes OS as ISO images that can be directly written to CD-R.

    1. Download the ISO images. These are available from one of the RedHat mirror sites. Use NcFTP for best results.
    2. Verify the integrity of each image with "md5sum iso-image" and compare with the MD5 sum posted on the FTP site.
    3. Write each CD with:
          cdrecord -v speed=16 dev=0,0,0 -data iso-image

    Burning an Audio CD

    Additional cdrecord options:


    On-The-Fly Copying


    On-the-fly copying means that the two CD drives are operating at the same time: the first one reads the source, and the second one writes onto the blank.

    Copy an audio CD with this command. It operates in two phases: first copying the audio to a disk file, and then writing to the CD blank.

    cdrdao copy –device 0,0,0 –source-device 0,1,0 \            –source-driver generic-mmc \            –eject –reload -v 1 -n \            –datafile /media/tmp/cdrdao.bin


    Burning a Mixed-mode CD

    A mixed-mode CD has both data and audio. It is a single session CD. The data is visible as a file system to a computer, and the audio is visible to CD players. The drawback to mixed mode is that the data track is visible to CD players, and some will even try to play it, and of course it does not sound good.

    To create a mixed-mode CD, create an ISO image as for Burning a Data CD, and collect the audio tracks. Run cdrecord with the like this:

    cdrecord "$@" speed=$SPEED dev=0,0,0 driveropts=burnproof -eject \  -data             \    mixed_mode.iso  \  -pad  -audio      \    song1.wav       \    song2.wav       \    (etc.)

    Burning an Enhanced CD (A.K.A CD-Plus, or CD-ROM XA mode 2)

    Similar to a mixed-mode CD, an enhanced CD also has both data and audio, and is a multi-session CD. The audio is written in the first session, and the data is written in the second session. Most CD players can only see tracks in the first session, effectively hiding the data track. The drawback to enhanced format is that some CD players cannot read multi-session CDs at all. See this entry in the CD-Writing HOW-TO on creating multi-session CDs.

    To create an enhanced CD, arrange the data for an ISO image as for Burning a Data CD, and collect the audio tracks.

    1. Write the audio tracks. Be sure to specify the -multi flag:

    cdrecord "$@" speed=$SPEED dev=0,0,0 driveropts=burnproof \  -multi -audio -pad \    song1.wav        \    song2.wav

    2. Determine where the free space on the CD begins with:

    NEXT_TRACK=`cdrecord -msinfo`

    3. Create an ISO image using the two numbers returned in step 2:

    mkisofs -o cd_plus.iso -R -J -C $NEXT_TRACK -r cd

    4. Verify the ISO image with:

    isoinfo -i cd_plus.iso -f -R -J -N ${NEXT_TRACK/*,}

    5. Write the data track:

    cdrecord "$@" speed=$SPEED dev=0,0,0 driveropts=burnproof -eject \  -data -pad \    cd_plus.iso

    Here is a script to help manage ISO contents (where "cd" is the directory with the contents):

    # Default speedSPEED=10
    
    # Process arguments. Identify speed and "blank" directives.SESSION_1_ARGS=SESSION_2_ARGS=for A in "$@"; do    if [ "blank=" = "${A:0:6}" ]; then        # Erase only before first session.	SESSION_1_ARGS="$SESSION_1_ARGS $A"    elif [ "speed=" = "${A:0:6}" ]; then        SPEED=${A#speed=}    else        SESSION_1_ARGS="$SESSION_1_ARGS $A"	SESSION_2_ARGS="$SESSION_2_ARGS $A"    fidone
    
    # Audio session.cdrecord $SESSION_1_ARGS speed=$SPEED dev=0,0,0 driveropts=burnproof \  -multi -audio -pad \    cd/song1.wav     \    cd/song2.wav
    
    # Figure out if the ISO image should be remade.# Note that audio files are stored inside the 'cd' directory.if [ ! -e cd_plus.iso -o -n "`find cd -newer cd_plus.iso`" ]; then    echo "Cleaning..."    find cd \( -name '*~' -o -name '*.bak' -o -type d -name '.*' -prune \) \         -print -exec rm -rf '{}' \;    echo    echo "Link check..."    html_link_check -start cd/READ-ME.html    echo    echo "Building ISO image..."    NEXT_TRACK=`cdrecord -msinfo`    echo $NEXT_TRACK > cd_plus_msinfo    mkisofs -o cd_plus.iso -R -J -C $NEXT_TRACK -r cd    echo    echo "Contents:"    isoinfo -i cd_plus.iso -f -R -J -N ${NEXT_TRACK/*,}    echofi
    
    # Data session.cdrecord $SESSION_2_ARGS speed=$SPEED dev=0,0,0 driveropts=burnproof -eject   \  -data -pad    \    cd_plus.iso
    

    Recording Live Audio

    • Use Gnome Sound Recorder (Programs > Multimedia > Sound Recorder) or Audacity to record. With Sound Recorder, record in stereo, not mono (it messes up mono recording). Use 16-bit PCM, 44.1 KHz, stereo mode.
    • Convert to mono with sox:
          for F in `*.st.wav`; do
            G=${F%.st.wav};
            echo $G;
            sox $F -c 1 $G.wav;
          done
    • Edit waveform using Audacity waveform editor. Export to .wav format.

    Converting to MP3

    Use lame to convert to mp3 format with:


    lame -h –vbr-new -p –strictly-enforce-ISO  \  –tt ‘track title’ –tn <track-number>      \  –ta ‘author’                                     \  –tl ‘album title’                                \  –ty <year-of-issue> –tc <comment>   \  file.wav  file.mp3

    Where:


    Troubleshooting


    cdrecord: (CHECK CONDITION)

    A complete failure of cdrecord of the form:


    cdrecord: Input/output error. read track info: scsi sendcmd: no error
    CDB:  52 01 00 00 00 FF 00 00 1C 00
    status: 0×2 (CHECK CONDITION)
    Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 24 00 00 00
    Sense Key: 0×5 Illegal Request, Segment 0
    Sense Code: 0×24 Qual 0×00 (invalid field in cdb) Fru 0×0
    Sense flags: Blk 0 (not valid)
    cmd finished after 0.000s timeout 240s
    Writing  time:    0.009s

    may indicate damaged media. Try a new CD blank. I had a repeated failure which was caused by attempting to record with GnomeToaster which for some reason had bad settings (really bad, apparently). The trouble maker was the "tsize" option was not compatible with cdrecord 2.0: remove it! Further bugs prevented the operation from completing. (Dummy recording mode is a great way to start.)


    Drive light on, but nobody’s home

    Here’s a checklist:

    1. Look in /var/log/messages — was the drive recognized during boot?
      If not, check your jumpers or BIOS.

    2. As root, run cdrecord dev=/dev/hdc -inq (replace /dev/hdc with your device). Expect to see the same identification the kernel received.
      No such file or directory: Are you sure you have the correct device (see /var/log/messages again)?
      Maybe udev did not create the device for you.

    3. As root, run cdrecord dev=/dev/hdc -prcap
      Expect to see a long list of device capabilities.

    4. Insert a data CD into the drive (blank or used, doesn’t matter). As root, run cdrecord dev=/dev/hdc -atip
      Expect to see data about the medium.
      "medium not present" — that’s not good. Maybe your drive is broken, or may it’s confused. Try shutting down system and powering off. Shut off power supply or remove power cable for 5 seconds — "reboot" will not do.

    5. With data CD in drive, as root run mount -r iso9660 /dev/hdc /mnt/cdrom (replace /mnt/cdrom as appropriate).
      Expect file system to mount. Try ls -l /mnt/cdrom
      "mount: no medium" — that’s not good. If you already powered off, I’m not sure what else you can do.

    6. As non-root user, try the commands shown above.
      Permission denied: check device permissions. You may not be in the correct access group. Check with the groups command. Add yourself and login again.
      udev may have assigned incorrect permissions.
    http://gentoo-wiki.com/HOWTO_Backup_a_DVD
    http://gentoo-wiki.com/DVD

     


    Linux Notes: Video Editing


    Video Editing Process

    1. Import video to hard disk.
    2. Editing video.
    3. Write out to Quicktime file, DVD, or video tape.

    Importing Video


    Disk Space Estimates

    Some estimates from various sources on the web:

    My actual experience with Canon GL-1 (format: digital video), record mode: SP, audio mode: 16 bit:


    Kernel 2.6.11.11 Hot plug

    Not much to it, really. First insure that /lib/modules/`uname -r`/modules.ieee1394map contains at least: raw1394, dv1394, ohci1394, and ieee1394. If not, compile and install these kernel modules. Then add these in your /etc/modules.autoload.d/kernel-2.6:

    # For IEEE-1394 (Firewire) bus.raw1394ohci1394

    (Order seems to be important here for system stability, though it’s not clear why.) Then load the modules with modprobe. They will load automatically on your next reboot.

    Configuring device node /dev/raw1394: The kernel module should do this, but it doesn’t. Do it manually:

    mknod -m 666 /dev/raw1394 c 171  0

    When you plug in the camera, the dv1394 module will be loaded automatically. If you do not have all four 1394 modules loaded, you will have problems.

    When the camera is unplugged, dv1394 is not unloaded. The system appears to consider the camera’s ieee1394 node in a "suspended" rather than "gone" state. The modules uses a small amount (about 20Kb) of kernel memory, and you can unload it manually with modprobe -r dv1394

    lsbus ieee1394 shows camera GUID.


    Import video with Kino

    Kino is gradually acquiring the same capabilities as dvgrab, though dvgrab may remain more capable. Try Kino first, as you can more easily see results.


    Importing video with dvgrab

    dvgrab is recommended for capture from IEEE-1394 (Firewire). Made by the Kino people (http://kino.schirmacher.de), dvgrab is a command line utility. These instructions also apply to Kino.

    Normally, you can just insert a tape in your camera and start dvgrab. It will find your camera and control the playback.

    Here’s what worked with my camera:

    1. Connect camera to computer with Firewire cable. Turn camera on in VCR mode. Insert tape and position at beginning of segment.

    2. Use lsbus ieee1394 to find the camera’s GUID. The Canon GL-1’s is "0×00008500001426B6".Use dvgrab 1.8 with the "–guid 0×00008500001426B6" option. Might work fine with other cameras without this option. Earlier versions do not work well with automatic camera control (AV/C), so also use the "–noavc" option. The minimum version of dvgrab which worked with this camera was 1.4.

    3. For recording longer than 4m40s (~1 Gb), use the "–autosplit" option. It will split the input files at around 1 Gb and also when the recording was stopped and restarted (nice!).

    4. Supply a base name of the form: "summer-vacation-" (note trailing hyphen).

    5. Start dvgrab with these options.

    6. Later versions of dvgrab will automatically start the camera playback. If not, start the camera (from stop, not pause). dvgrab will detect that the camera has started playing and will begin capturing.When done, stop dvgrab with Ctrl-C (dvgrab won’t stop if you stop the camera, though will not store blank frames on disk).

    dvgrab produces AVI files. These may be used directly by either Kino or Cinelerra, and may be viewed with mplayer.

    Importing video with dvconnect

    dvconnect can capture video using the video1394 driver, though it does not split the source into scenes, or limit the capture file size, as dvgrab can.

    Unlike dvgrab, dvconnect starts capturing as soon as it is started, and stops when playback stops. Start the dvconnect before starting the camera playback. Stop dvconnect with Ctrl-C after the camera is stopped.

    Files captured with dvconnect can be tested with playdv.


    Determining file type

    Determine file type with transcode (also see Transcode Recipes):

    tcprobe -i file

    Pre-processing

    Transcode is good for batch pre-processing before the editing begins. However, it’s a pain to figure out. Here are some recipies.

    Cut/Splice AVI Files


    Editing Video with Cinelerra

    I use Cinelerra to edit video. It allows multiple video and audio tracks, and separation of video from audio. Kino does not (which may be an advantage sometimes).

    My system was too slow for this software (933 Mhz P-III with IDE drives). For example, I suffered video drop-outs while playing an unaltered movie in the compositor while tracking in the navigator window. Playing multiple or masked tracks was out of the question. Playback hung while stepping forward by one frame.

    So I upgraded my hardware. Cinelerra always hungs after play-then-stop, and I had to kill it. I found the solution in a bug on their Sourceforge site. To avoid this bug, run:

    LD_ASSUME_KERNEL=2.2.5 cinelerra

    (Prefixing an executable with environment variable assignments is a bash shell feature.) This doesn’t seem to be a problem with version 1.1.7 package from Gentoo or with the 2.6 kernel.

    dvgrab is recommended for capture from IEEE-1394 (Firewire).

    Building and Maintaining Cinelerra

    I found that Gentoo packages were released too infrequently for my use, and the best stuff was in the CVS code repository at cvs.cinelerra.org. Keeping the code running was surprising difficult. It broke often because I upgraded other packages on my system rather oftern, and Cinelerra depends on many other libraries. See my build notes.

    Output Dimensions

    Know your output dimensions before you start. If you need to crop after editing, you’ll be sorry.


    Use Clips

    Cinelerra allows only one audio/video sequence to be edited at a time. Clips allow you to save a switch between different bits of work.

    website free tracking