[MPlayer-users] Mencoder wrapper script
Samuel Kesterson
samuelk at datatrade.com
Fri Nov 16 20:08:50 CET 2001
Hi!
First let me say thanks to the MPlayer team for producing an player/encoder
for Linux that is simple to use and produces great results.
I would like to see if anyone else is having the problem I am. Some DVD's I
try to rip want to start part way (5-30 seconds) into the movie. "Final
Fantasy" and Python's "Holy Grail" both do this. Not a big deal in mplayer as
I can just use the -ss to rewind how many seconds were skipped. However,
mencoder doesn't have that options yet. Could it be put in? I would do it
myself, but I am not quite that familiar with the source yet. If there is
another way to accomplish this please do clue me in.
I was ripping some DVD's recently (for backups of course :) ). I did what I
always do started the job going with a command line something like this:
`mencoder -dvd 1 -aid 128 -o FILE.avi && mencoder -dvd -aod 128 -o FILE.avi`
Who can se what is wrong with this? That's right ... mencoder doesn't have an
-aod option so (8+ hours later) I ended up with a single pass rip of one of
my DVD's without even knowing until watching it later (logged out and left it
alone while it was ripping).
Included inline below is a PERL script I wrote to make sure I use the same
command line switches for both passes. I included it because I seem to
remember a couple of people wanting something like it. NOTE: I finished
writing this in the very early hours of the morning. It seems to work fine
for me but YMMV of course. -- Enjoy!
Please excuse me if this is not the place to post this. I'm trying to help :)
------------------------- SNIP ---------------------------------
#!/usr/bin/perl
# Only use on DVD's you own. Not intended for illegal purposes.
# Author not responsible for end use. Blah, Blah, Blah ...
#
# By Samuel Kesterson <skesterson at earthlink.net> circa 11/15/2001
#
# 1) If you like this, great! Use it all you like.
# 2) If you don't like it, don't use it (or hack it to suit your needs) :-).
#
# 3) I mostly made this to make sure I use the same options on both encode
# passes. Maybe someone else can get some use out of it too.
#
# 4) This script will pass any *extra* (as in, not listed in `dvdrip -h`)
# right on to MEncoder. This is by design. I only redid the options I
# did because they are the ones I use most often and I figured I would
# save myself some typing.
#
# 5) Could this have been written better? Probably. See number 2.
#
sub Print_Help # Just a usage message sub
{
print("DVD Ripper wrapper script for mencoder\n");
print("Usage:\n\n");
print("dvdrip -c CHAPTER <options> -o OUTFILE\n");
print("Where <options> are the following\n");
print("-d : If present the script will not show, nor ask ");
print("you for correctness of, the command line you entered. ");
print("(For background processing)\n");
print("-d4o : <DIVX4OPTS> \`man mencoder\`\n");
print("-llo : <LIBMP3LAMEOPTS> \`man mencoder\`\n");
print("-q : Quiet operation (No encoding output)\n");
print("-aid : Audio track ID\n");
}
if ($ARGV[0] eq "" || $ARGV[0] eq "-h")
{
Print_Help();
exit(1);
}
$command = "mencoder ";
for($i=0; $i<@ARGV; $i++)
{
$j = $i + 1;
if($ARGV[$i] eq "-d4o")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$command .= "-divx4opts " . $ARGV[$j] . " ";
}
}
elsif($ARGV[$i] eq "-llo")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$command .= "-lameopts " . $ARGV[$j] . " ";
}
}
elsif($ARGV[$i] eq "-c")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$command .= "-dvd " . $ARGV[$j] . " ";
}
}
elsif($ARGV[$i] eq "-o")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$command .= "-o " . $ARGV[$j] . " ";
}
}
elsif($ARGV[$i] eq "-aid")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$command .= "-aid " . $ARGV[$j] . " ";
}
}
elsif($ARGV[$i] eq "-q")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
# fixme when mencoder has a -quite option
$quiet = "y";
}
}
elsif($ARGV[$i] eq "-d")
{
if(substr($ARGV[$j], 0,1) ne "-")
{
$DAEMON = "yes";
}
}
}
if($quiet eq "y")
{
$comm = $command . "-pass 1 2>&1 > /dev/null && " . $command ."
-pass 2 2>&1 > /dev/null";
}
else
{
$comm = $command . "-pass 1 && " . $command ." -pass 2";
}
if($DAEMON eq "yes")
{
system("$comm");
}
else
{
print("Starting MEncoder with the following command line:\n$comm\nIs
this correct? [y/n]");
$answer = <STDIN>;
if(substr($answer, 0,1) eq "y" || substr($answer, 0,1) eq "Y")
{
system("$comm");
}
else
{
print("Please check your command line and try again.\n");
exit(1);
}
}
------------------------------------ SNIP -----------------------------------
Thanks again guys.
More information about the MPlayer-users
mailing list