SourceForge.net Logo

DVDShrink

Back to the Home Page

Overview
DVDShrink is a console based DVD 'shrinker' for Linux or any other OS that has the necessary tools. It will take a commercial DVD and place the main feature onto a DVD-R, adjusting it's size if needed. It does NOT do a complete copy of a DVD but only of the main title, ONE audio track and ONE subtitle track.

Folks, this is all 'smoke and mirrors' to quote a good friend of mine who I spent several hours with debugging. If things don't go quite as planned, have a look at the code; figure out what commands are being called and try it manually.

Features
    Automatic configuration
      On first execution the script will prompt the user for the values that it needs to run. After that the script will determine what it needs.
    Automatic mode
      No intervention from the user is required. This is the default mode but can be over-ridden from the command-line with a full-featured set of options.

      If the user has two DVD devices (ie: a reader and a burner) the script can be configured or run to do an auto-burn of the copy.
    Failure handling
      If one of a set of pre-determined commands fails the script offers the user the ability to attempt to fix any problem and re-start the script from the point of failure; saving time and worry.
    Progress reporting
      A simple but informative user interface. The user knows what step the script is at at all times, but the output from the various tools is surpressed; most being many lines of gobledy-gook.
    Space saving
      The script can be configured/run to remove working files as they become redundant thereby saving space on the hard drive.
    Simplicity
      No in-depth knowledge of DVD structure or layout is required by the user.
Required Software
The following software MUST be installed and functioning for the DVDShrink to do it's job:
  • The transcode package and it's required codecs (ripping etc),
  • the mjpegtools package (re-multiplexing),
  • the mkisofs package (creating ISO images),
  • the subtitleripper package (converting subtitles),
  • the gocr package (for subtitles),
  • the dvd+rw-tools package (burning), and
  • the dvdauthor package (authoring DVDs).
The script also makes calls to 'cat', 'stat' and a few other standard Linux tools. You'll want to make sure that they are in your toolset (coreutils package).

If you want to run the GUI front-end you'll need to have perl and perl-GTK2 installed.

Script function
The script is written for bash. It won't work on any other shell.

The script follows a fixed set of steps in shrinking a DVD down from a size that fits on a DVD9 (commercial) to one that fits onto a DVD-R or RW. These are:
      determine the DVD's Volume ID       -> dd           (coreutils)
      determine the DVD's chapter scheme  -> tcprobe      (transcode)
      rip the tracks                      -> tccat        (transcode)
                                          -> tcextract    (transcode)   
      resize the video track              -> tcrequant    (transcode)
      remultiplex the video and audio     -> mplex        (mjpegtools)
      turn the subtitle track into images -> subtitle2pgm (subtitleripper)
      mux the subtitles with the MPEG2    -> spumux       (dvdauthor)
      author the DVD                      -> dvdauthor    (dvdauthor)
      create an ISO image                 -> mkisofs      (mkisofs)
            or
      burn the new DVD                    -> growisofs    (dvd+rw-tools)   

The script writes it's progress in the project's directory tree which keeps track of where it is in the process. If the script is restarted with the --restart option, it reads this file and knows where to begin anew. Also, once in a blue moon a command WILL finish with usable output but will error out. In this case, if the output looks good issue the --jumpin option to continue on as if nothing happened

The script writes it's run-time variables in a file called '/tmp/dvdshrink.var' which is read after a failure/restart and allows the script to skip many of the 'houskeeping' functions and go right to the correct spot to begin execution with all needed variables set.

The script will place all of it's working and temporary files in a directory called $BASEDIR/ by default. $BASEDIR is set by the user during initial configuration. Make sure that the directory selected is on a file system that has enough space to hold about twice the size of the original movie (from 10G to 18G).

Script Options
-A|--authoronly
    This will have the script stop after authoring the new DVD5. It will leave the files in the directory //BUILD. You can use the 'mkisofs' command on this directory to make an ISO image of the DVD or use 'growisofs' to burn it to DVD5.
-B|--noburn
    Tells dvdshrink to prompt you before it tries to burn a new DVD
-D|--nodeletefiles
    Tells dvdshrink _NOT_ to remove it's working files as it goes (to a point). This will take up a LOT of disk space, but will leave you the files if you need them later.
-F|--forceburn
    Tells dvdshrink that you don't want to be prompted before burning (only works if you have more than one device). After authoring it will auto- matically start the burn to your blank.
-I|--info
    If this option is passed dvdshrink will read the information for the first title on the source DVD and present it to you.
-K|--noshrink
    Tells dvdshrink _NOT_ to shrink the video stream at all. If you are buring to a dual-layer DVD then you can pass this and get a less com- pressed MPEG2 file.
-L|--listall
    Tells dvdshrink to present you with a list of the titles, then a list of the audio streams, THEN a list of the subtitle streams. You can chose which ones you want to work on from the lists. The same as is- suing -t list -a list -u list.
-M|--bigmpegonly
    Tells dvdshrink to _STOP_ after ripping the selected streams and re- multiplexing them into a new MPEG2 file while _NOT_ shrinking the video stream.
-O}--saveiso
    Allows creation of an archival ISO image along with the DVD burn.
-P|--pauseonexit
    This was added for the GUI so that the console window would be left open after the project was complete. If it wasn't issued then the console would disappear as soon as the project finished (or errored) and you would not know what happened in the case of an error.
-S|--bigstreamonly
    Tells dvdshrink to just rip the elemental streams (video, audio and subtitle) that you selected then _STOP_.
-T|--showtitles
    Dvdshrink will present you a list of all the titles on the DVD then exit.
-V|--showvalues
    Normally, dvdshrink shows you a small synopsis of what it's going to do before it starts doing it. With this option passed, dvdshrink will tell you a whole lot more and give you a chance to back out.
-a|--audio <num>
    This option allows you to pass a specified audio stream to dvdshrink to be ripped. The default is 0 which is the first audio stream on the source DVD. If you want to see a list of the audio streams then pass -a list to the app.
-b|--burn
    Tells dvdshrink to auto-burn the new DVD. This does _NOT_ mean that it won't prompt you, but it tells you that it's ready to go and gives you a last chance to put the blank in.
-c|--configure
    Allows you to re-configure dvdshrink.
-d|--deletefiles
    Passing this option over-rides whatever is in the default configuration and allows you to have dvdshrink auto-delete it's working files even if you've set it not to in the configuration. It saves space on the working drive.
-e|--episodes <num>
    On an 'episodic' source DVD9 like a television show set, this tells dvdshrink how much to shrink each MPEG2 file so that you can put on a single DVD5. Normally it is not used for movies and is only passed to dvdshrink by the 'batchrip.sh' script.
-i|--isoonly
    Tells dvdshrink to _NOT_ burn a new DVD5 but to create an ISO file that can be used to create one. Stored in /tmp.
-k|--shrinkfactor <val>
    The amount that dvdshrink will compress an MPEG2 file to fit where you want it to fit (normally on a DVD5). 1.0 means 'no compression' and the script will only allow you a maximum value of 2.0. Anything higher an you get spotty output which may not work at all. The calculation used is as follows:
       
       k = (1.05  v)/(4.7G - (a + s)
          k = shrink factor
          v = size of video stream
          a = size of audio stream
          s = 10MB
    
-l|--deletelogs
    This switch tells dvdshrink to delete the log files that it keeps in your home directory after a successful rip. If the script abends then the log files are kept for your perusal.
-m|--mpegonly
    Tells dvdshrink to create an MPEG2 file and _STOP_. This file can be used as is or used to custom author a new DVD5 using 'dvdauthor'
-o|--isodir <dir>
    Sets an ISO image storage location.
-p|--project <name>
    The project name is the name that is used to create all the direct- ories and filenames during a rip sequence (see Definitions)
-r|--read_device <dev>
    This is passed to dvdshrink to specify a read device _OTHER_ than that specified in the configuration.
-s|--streamonly
    Tells dvdshrink to rip the elemental streams (video, audio and subtitles) and then shrink the video stream then _STOP_.
-t|--title
    Allows you to specify which title on the DVD9 to rip. Normally on a movie the first title (1) is the main feature. But if it's another title you want then you can specify. Use -t list to get a list of titles on the source DVD to select from.
-u_subtitle <num>
    Allows you to specify which subtitle stream to rip. Normally this is not selected. If the DVD9 you want to rip is _NOT_ in your native lan- guage and there is no native language audio stream then you can select a subtitle stream. Or, if you are hearing impaired this allows you to rip and properly 'mux' in the subtitles. Use -u list to see a list to select from.

    Note: This is smoke and mirrors. On some DVDs you may get a 95-96% rate of good subtitles. On others you'll do better. In any case, there may be a title or two that are corrupt.
-v|--version
    Show the version information and exit.
-w|--write_device <dev>
    Over-ride the write device in the configuration with the device specified by issuing the -w option.
-h|--help
    A short synopsis of this page.
--long-help
    A longer synopsis of this page.
--restart
    If dvdshrink errors you will be told what happened, and where to find more information. If you think you can (or have) fixed the problem you can re- start dvdshrink with the --restart option to start with the function that generated the error (makes life simple).
--jumpin
    If dvdshrink errors and you _KNOW_ that the error is wrong you can re-start dvdshrink with the _NEXT_ function in line to attempt to carry on.