#!/usr/bin/perl
#
# dvd2xvid
# Copyright (C) 2005 surfmasta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
use Getopt::Long;
###
### Set an optional mencoder path (ie. for an own build)
###
$MENCODER_PATH = "";
GetOptions("i=s" => \$ifile,
"o=s" => \$ofile,
"b=s" => \$bitrate,
"t" => \$test,
"m=s" => \$mencoder_cmd,
"e=s" => \$encoder_cmd);
if ($ifile && $ofile) {
print "#########################################\n";
print "### dvd2xvid v1.0 ###\n";
print "#########################################\n\n";
if ($test) {
print " !!! TEST-Modus aktiviert (Es wird eine 15 Sekunden Vorschau generiert) !!!\n\n";
}
print " DVD-Image: $ifile\n";
print " Ausgabedatei: $ofile\n\n";
} else {
print "Anwendung: dvd2xvid -i -o \n";
print " -i Eingabequelle angeben (z.B. /dev/dvd oder /home/user/dvdrip/MEIN_DVD_IMAGE)\n";
print " Im Beispiel ist MEIN_DVD_IMAGE ein DVD Abbild welches z.B. mit dvdbackup -M -i /dev/dvd -o ./\n";
print " erzeugt wurde\n";
print " -o Datei fuer die Ausgabe angeben (z.B. -o mein_film.dvdrip.xvid.avi)\n";
print " -b Optionale Bitrate angeben (z.B. -b 1200 / Standard: -b 900)\n";
print " -t Test Modus aktivieren. Dadurch wird eine 15 Sekunden Vorschau vom Ripvorgang erstellt\n";
print " die ab der 5ten Filmminute des Films beginnt\n";
print " -m Optionale mencoder Parameter angeben\n";
print " -e Optionale XVID-Encoder Parameter fuer den mencoder angeben (z.B. -e cartoon:gmc)\n";
exit;
}
if ($test) {
$test = "-ss 300 -endpos 15";
} else {
$test = "";
}
###
### Getting the main movie title
###
open OUTPUT, "lsdvd $ifile 2>&1 |";
$mainmovielength = "00";
while ($output=