Penguin

stazenc

Update : Has any of the WLUG'ers have some NTSC DVDs I can please borrow. I have rewritten the script to work with NTSC DVDs, and it has worked perfectly on the only NTSC DVD in my collection. Once I confirm the script works with a few more discs I'll update the wiki with the new code. Cheers!

I have written a bash script that from a directory containing vob files, will make an extremely good looking XviD dvdrip. I'd really appreciate it if you would try it out and let me know if there are any bugs. I've had great success with it. At the moment it only works on a PAL DVD source, but it the future this will be updated to make perfect rips from an NTSC source. Will also be updated to make rips of DVD's containing tv-eps.

Required Arguments

  • The first argument is always the path to the vob directory.
  • --title <n> or -t <n> : This tells the script which DVD title we wish to encode. (Get a list of them with the argument --list-titles) Note : n is a NUMBER. Make sure to choose the right one (look at the lengths of each title after using the '-l' option.)
  • --output <file> or -o <file> : This is the output filename. Eg : armageddon.avi

Optional Arguments

  • --max-ar-error <n> or -e <n> : This tells us the maximum AR error (percentage) to allow. This defaults at 3. I wouldn't make this value any higher than 5.

Changelog

28/12/2006
Fixed : Bug causing all files to be hidden!

27/12/2006
Added : It should now be possible to encode to XviD directly from the DVD disc, provided the DVD only has CSS encryption and
nothing too fancy :) If the Supplied dir argument is a mounted DVD (cannot be written to), then the $PWD will be used as our
working directory, otherwise the vob dir will be used as our working directory.

Added : Added some xvidenc options to set quantization type as H.263 and to make sure that qpel and gmc are not used as these
can cause problems on standalone players.

26/12/2006
Added : Title and Output Filename options are now mandatory and the script will now detect if they are missing.

Fixed : Listing .vob files now working.

25/12/2006
Added : Different range of possible resolutions for the output video, depending on whether we have a WS or FS source.

Tools Needed:

1) Mplayer & Mencoder

2) Transcode Package

3) lsdvd

4) lame v3.97

5) XviD codec (libxvidcore4)

6) mp3gain (Sorry I forgot all about this!)

7) Midentify (Put this script inside /usr/local/bin/ or somewhere else in $PATH)

#!/bin/sh
#
#This is is a wrapper around the -identify functionality.
# It is supposed to escape the output properly, so it can be easily
# used in shellscripts by 'eval'ing the output of this script.
#
# Written by Tobias Diedrich <ranma+mplayer@tdiedrich.de>
# Licensed under GNU GPL.

if [ -z "$1" ]; then
        echo "Usage: midentify <file> [<file> ...]"
        exit 1
fi

mplayer -vo null -ao null -frames 0 -identify "$@" 2>/dev/null |
        sed -ne '/^ID_/ {
                          s/[]()|&;<>`'"'"'\\!$" []/\\&/g;p
                        }'

8) ~/.mplayer/cropping.conf (Create This File)

RIGHT change_rectangle 2 +2
LEFT change_rectangle 2 -2
DOWN change_rectangle 3 +2
UP change_rectangle 3 -2
KP6 change_rectangle 0 +2
KP4 change_rectangle 0 -2
KP2 change_rectangle 1 +2
KP8 change_rectangle 1 -2
PGUP seek +60
PGDWN seek -60
q quit
ESC quit
ENTER pt_step 1 1
p pause
SPACE pause
f vo_fullscreen

Stazenc Script

http://source.meta.net.nz/svn/staz/stazenc/trunk/stazenc

Example of Usage

  • stazenc Armageddon/ -mar 2 -t 1 -o armageddon.avi

Soon after typing this command mplayer will popup and start playing your chosen title from the DVD. You will notice the outline of a white rectangle that overlays the video. Basically what you want to do is to manipulate the rectangle so that it surrounds the video and crops out any black area around the video. Use the main arrow keys to move the entire rectangle and the numpad arrow keys to increase/decrease the width and height. What I recommend is.

  • 1) Use the main arrow keys to move the rectangle so the top right of the rectangle exactly matches the top right of the video that is being played.
  • 2) Now use the numpad arrow keys to resize the rectangle to perfectly surround the video.
  • 3) Press The Page-Up a key a few times to skip through the video and make sure your cropping values are still appropriate. My philosophy is to apply the MAX amount of cropping possible without overcropping any frames elsewhere in the video.
  • 4) Good now press escape (closes mplayer) and there is no more effort required by you! Sit back and relax.