1 # Author: Alan J. Pippin
\r
2 # Perl script written for a windows based machine running
\r
3 # Real Producer to auotmatically create rm videos for all
\r
4 # the avi files in a given directory.
\r
6 #$dvpath = "U:\\MiniDV\\";
\r
7 #$dvpath = "U:\\DVtoRM\\";
\r
8 $dvpath = "V:\\MiniDV\\";
\r
9 $webdir = "V:\\RealContent\\www";
\r
10 $ipaqdir= "V:\\RealContent\\ipaq";
\r
11 $hqdir = "V:\\RealContent\\HQ";
\r
12 $producer = "C:\\Program\ Files\\Real\\Helix\ Producer\ Plus\\producer.exe";
\r
13 $author = "Alan J. Pippin";
\r
14 $date_prog = "F:\\cygwin\\bin\\date.exe";
\r
15 $logfile = "V:\\RealContent\\convert.log";
\r
16 $audiogain = 0; # Can be -12 to 12
\r
18 $makeweb = 1; # Can be 0 or 1
\r
19 $makeipaq = 0; # Can be 0 or 1
\r
20 $makehq = 0; # Can be 0 or 1
\r
22 opendir( DIR, $dvpath ) or die "Can't open $path: $!";
\r
26 $start_time = `$date_prog`; chomp $start_time;
\r
29 while ( $file = readdir( DIR ) ) {
\r
30 if( -d "$path\\$file" ) { next; }
\r
31 if( $file !~ /\.avi|mpg|mpg2$/) { next; }
\r
37 opendir( DIR, $dvpath );
\r
38 print "------------------------------------------------------------------\n";
\r
39 print "-> Converting all video files in $dvpath to web streamed rm files...\n";
\r
40 print "------------------------------------------------------------------\n\n";
\r
42 while ( $file = readdir( DIR ) ) {
\r
43 if( -d "$path\\$file" ) { next; }
\r
44 if( $file !~ /\.avi|mpg|mpg2$/) { next; }
\r
46 $file =~ /^(.*?)\.(avi|mpg|mpg2)$/; $filename = $1; $ext = $2;
\r
47 $date = `$date_prog`;
\r
48 $outfile = "$filename.rm"; $outfile =~ s/\s/_/g; $outfile =~ tr/[A-Z]/[a-z]/;
\r
49 $outfile = "$webdir\\$outfile";
\r
50 print "-> [$fileno/$numfiles] Encoding $filename.$ext -> $outfile\n";
\r
51 print " Started $date";
\r
52 if( -e "$outfile") { print " Output file $outfile already exists...\n"; next; }
\r
53 $options = "-t \"$filename\" -a \"$author\" -i \"$file\" ";
\r
54 $options.= "-o \"$outfile\" -ad \"28k,56k,128k,150k\" ";
\r
55 $options.= "-rs 320x213 -ag $audiogain";
\r
56 system("\"$producer\" $options");
\r
58 $date = `$date_prog`;
\r
59 print " Finished $date\n\n";
\r
65 opendir( DIR, $dvpath );
\r
66 print "-------------------------------------------------------------------------\n";
\r
67 print "-> Converting all avi files in $dvpath to ipaq single streamed rm files...\n";
\r
68 print "-------------------------------------------------------------------------\n\n";
\r
70 while ( $file = readdir( DIR ) ) {
\r
71 if( -d "$path\\$file" ) { next; }
\r
72 if( $file !~ /\.avi$/) { next; }
\r
74 $file =~ /^(.*?)\.avi$/; $filename = $1;
\r
75 $date = `$date_prog`;
\r
76 $outfile = "$filename"; $outfile =~ s/\s/_/g; $outfile =~ tr/[A-Z]/[a-z]/; $outfile.="_ipaq.rm";
\r
77 $outfile = "$ipaqdir\\$outfile";
\r
78 print "-> [$fileno/$numfiles] Encoding $filename.avi -> $outfile\n";
\r
79 print " Started $date";
\r
80 if( -e "$outfile") { print " Output file already exists...\n"; next; }
\r
81 $options = "-t \"$filename\" -a \"$author\" -i \"$file\" ";
\r
82 $options.= "-o \"$outfile\" -ad \"128k\" ";
\r
83 $options.= "-rs 320x240 -ag $audiogain";
\r
84 system("\"$producer\" $options");
\r
86 $date = `$date_prog`;
\r
87 print " Finished $date\n\n";
\r
93 opendir( DIR, $dvpath );
\r
94 print "-------------------------------------------------------------------------\n";
\r
95 print "-> Converting all avi files in $dvpath to HighQual single streamed rm files...\n";
\r
96 print "-------------------------------------------------------------------------\n\n";
\r
98 while ( $file = readdir( DIR ) ) {
\r
99 if( -d "$path\\$file" ) { next; }
\r
100 if( $file !~ /\.avi$/) { next; }
\r
102 $file =~ /^(.*?)\.avi$/; $filename = $1;
\r
103 $date = `$date_prog`;
\r
104 $outfile = "$filename"; $outfile =~ s/\s/_/g; $outfile =~ tr/[A-Z]/[a-z]/; $outfile.="_hq.rm";
\r
105 $outfile = "$hqdir\\$outfile";
\r
106 print "-> [$fileno/$numfiles] Encoding $filename.avi -> $outfile\n";
\r
107 print " Started $date";
\r
108 if( -e "$outfile") { print " Output file already exists...\n"; next; }
\r
109 $options = "-t \"$filename\" -a \"$author\" -i \"$file\" ";
\r
110 $options.= "-o \"$outfile\" -ad \"512k\" ";
\r
111 $options.= "-rs 720x480 -ag $audiogain";
\r
112 system("\"$producer\" $options");
\r
114 $date = `$date_prog`;
\r
115 print " Finished $date\n\n";
\r
120 $stop_time = `$date_prog`; chomp $stop_time;
\r
122 print "Total Time Summary:\n$start_time\n$stop_time\n\n";
\r
123 print "Press 'Enter' to continue..."; <STDIN>
\r