#!/usr/bin/perl # # (c) 20060801 by Ewald use strict; my $DEBUG = 1; my @files = glob( "*.mp4" ); # get files to work on my $out1; my $out2; my $org; foreach my $file ( @files ) { next if -d $file; # directory? next if -z $file; # zero byte ? $DEBUG && print "$file\n"; $org = $file; $file =~ tr/A-Z/a-z/; # lowercase $file =~ tr/\ /_/; # get rid of spaces $file =~ s/[\'\"\[\]\(\)\$\&]//g; # get rid of special char's $file =~ s/\.mp4$//; # strip extension $DEBUG && print "$file\n"; $org =~ s/(.)/\\$1/g; # escape everything for the shell $out1 = $file . ".avi"; print "transcoding $file\n"; $DEBUG && print "mencoder $org -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o $out1\n"; qx(mencoder $org -quiet -oac pcm -ovc xvid -ofps 15 -vf scale=160:-2 -xvidencopts bitrate=256:vhq=4:me_quality=4:max_bframes=0 -o $out1); $out2 = "U3_" . $out1; $DEBUG && print "transcode -i $out1 -P1 -b 0,1 -o $out2\n"; qx(transcode -i $out1 -P1 -b 0,1 -o $out2); unlink $out1; # remove intermediate file $DEBUG && exit 0; # in debug we run only once }