Sunday, April 6, 2014

Backup and playback DVD from hard drive using command line

This post is about how to backup and playback DVD content on a hard drive using the command line.

  1. Check available space on hard drive.
     
    $ df -h
    Filesystem               Size  Used Avail Use% Mounted on
    rootfs                   1.4T   41G  1.2T   4% /
    udev                      10M     0   10M   0% /dev
    tmpfs                    1.6G  900K  1.6G   1% /run
    /dev/disk/by-uuid/6c30b  1.4T   41G  1.2T   4% /
    tmpfs                    5.0M     0  5.0M   0% /run/lock
    tmpfs                    9.6G  640K  9.6G   1% /run/shm
    

    The df command indicates that 1.2 TB is available on my hard drive, which is plenty to hold the 4 GB DVD.

  2. Insert disc into DVD drive.
  3. Backup DVD.

    Both the dd and readom commands write to a single iso file. The dvdbackup command writes out the DVD file structure - the complete VIDEO_TS folder.

    • dd
      $ dd if=/dev/dvd of=~/birthday.iso
      8310528+0 records in
      8310528+0 records out
      4254990336 bytes (4.3 GB) copied, 303.204 s, 14.0 MB/s
      
    • readom

      According to its man page, "unless you want to risk getting problems, readom should be run as root." Hence, sudo below.

      $ sudo readom dev=/dev/dvd f= ~/birthday.iso 
      Read  speed:  5540 kB/s (CD  31x, DVD  4x).
      Write speed: 22160 kB/s (CD 125x, DVD 16x).
      Capacity: 2077632 Blocks = 4155264 kBytes = 4057 MBytes = 4254 prMB
      Sectorsize: 2048 Bytes
      Copy from SCSI (3,0,0) disk to file '/home/peter/birthday.iso'
      end:   2077632
      addr:  2077632 cnt: 64
      Time total: 277.602sec
      Read 4155264.00 kB at 14968.4 kB/sec.
      
    • dvdbackup

      The -o parameter specifies the output directory under which the DVD file structure will be copied. This directory does not need to be unique for your DVDs. This is because a title sub-directory will be created under it. For example, you can have a common ~/movies output directory for all your home movies with different titles.

      The -M parameter specifies that you want to "mirror", i.e., backup, the whole DVD.

      The optional -p parameter enables progress reporting during the backup operation.

      $ dvdbackup -p -M -i /dev/dvd -o ~/movies
      libdvdread: Using libdvdcss version 1.2.13 for DVD access
      libdvdread: Attempting to retrieve all CSS keys
      libdvdread: This can take a long time, please be patient
      libdvdread: Get key for /VIDEO_TS/VIDEO_TS.VOB at 0x0000011e
      libdvdread: Elapsed time 0
      libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x0000358c
      libdvdread: Elapsed time 0
      libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x00003710
      libdvdread: Elapsed time 0
      libdvdread: Found 1 VTS's
      libdvdread: Elapsed time 0
      Copying menu: 100% done (26/26 MiB)
      Copying menu: 100% done (1/1 MiB)
      Copying Title, part 1/4: 100% done (1024/1024 MiB)
      Copying Title, part 2/4: 100% done (1024/1024 MiB)
      Copying Title, part 3/4: 100% done (1024/1024 MiB)
      Copying Title, part 4/4: 100% done (958/958 MiB)
      
  4. Playback video.

    My favorite video player is VideoLAN, aka vlc. It can open an iso file as well as a title directory.

    To play back a DVD backed up using dvdbackup:

    $ vlc --fullscreen  ~/movies/2014birthday
    

    Note that 2014birthday is the title directory created under the ~/movies directory.

    To play back a DVD backed up using dd or readom, you need to first mount the iso file:

    $ sudo mkdir /mnt/iso
    $ sudo mount -t iso9660 -o ro,loop ~/birthday.iso /mnt/iso
    $ vlc --fullscreen  /mnt/iso
    

My next article discusses the same topic but introduces GUI tools.

No comments: