synced with r22800 (missing from previous commit)
[mplayer/glamo.git] / TOOLS / menc2pass
blobc52533fef30349e84fecce8e804cab209e4e049f
1 #!/usr/bin/perl -w
2 # Helper script to ease MEncoder two pass encoding
3 # Copyleft 2001 by Felix Buenemann <atmosfear@users.sourceforge.net>
4 # This file comes under GPL, see http://www.gnu.org/copyleft/gpl.html for more
5 # information on it's licensing.
6 use strict;
7 my $mencoder="mencoder"; # Path to MEncoder (including binary name)
9 die <<"EOF" unless @ARGV;
10 Menc2Pass: No arguments given!
11 Please give all usual encoding parameters you would give to mencoder, but leave
12 away the pass=<n> suboption.
13 EOF
15 for(my $i=1; $i<=2; $i++) {
16 my $parm="";
17 foreach my $val (@ARGV) {
18 if($val =~ /-lavcopts/) {
19 $parm.="$val vpass=$i:";
20 } elsif($val =~ /-(divx4)|(xvid)opts/) {
21 $parm.="$val pass=$i:";
22 } else {
23 $parm.="$val ";
26 print "Running $mencoder $parm\n";
27 system($mencoder,$parm)
28 and die "MEncoder pass $i failed!\n"