$|=1; if ($ARGV[0] eq '-g') { shift; $globbing=1; } unless (@ARGV==3) { $me=$0; $me =~ s/.*[\/\\]//; print < $me -g Opens the input AVI and transcodes it to the output AVI using the settings specified in SettingsScript. This script can be generated by preparing a prototype session in VirtualDub and choosing 'File' | 'Save processing settings...'. The two AVIs cannot be the same file (i.e. no in-place transcoding is allowed). EOL exit; } # set this to your VirtualDub EXE's location (no quotes, since 'start' doesn't like them) $vdub = qq(D:\\Progra~1\\VirtualDub\\VirtualDub.exe); # temporary script filename $temp = "temp.syl"; if ($ENV{'TEMP'}) { $temp = "$ENV{'TEMP'}\\$temp"; } # use env var if available if ($globbing) { my ($inGlob,$outDir,$script) = @ARGV; print "Globbing over '$inGlob'...\n"; @inFiles = glob($inGlob); print "Processing ".(scalar@inFiles)." file".((scalar@inFiles)==1?'':'s').".\n"; FILE: for $file (@inFiles) { next unless (-f $file); ($fn = $file) =~ s/.*[\/\\]//; ($outFile = $outDir) =~ s#/#\\#g; $outFile =~ s/\\*$/\\/; $outFile .= $fn; if (-e $outFile && !$overwriteAll) { while (1) { print "Overwrite '$outFile'? [y,n,a] "; $resp = ; if ($resp =~ /^a$/i) { $overwriteAll=1; last; } if ($resp =~ /^y$/i) { last; } if ($resp =~ /^n$/i) { next FILE; } } } #print "'$file' -> '$outFile'\n"; transcode($file,$outFile,$script); } } else { transcode(@ARGV); } sub transcode { my ($in,$out,$script) = @_; print "Transcoding '$in' -> '$out' using '$script'...\n"; print " Creating script '$temp'...\n"; # double all backslashes $in =~ s/\\/\\\\/g; $out =~ s/\\/\\\\/g; # read settings script open FPscr,"$script" or die "Unable to open settings script '$script' ($!)\n"; $settingScript = join('',); close FPscr; # open temp script open FP,">$temp" or die "Unable to open temp script ($temp) for writing ($!)\n"; # write temp script print FP <