scorpias
December 25th, 2009, 11:11 AM
If anyone is interest I created a perl script that will convert any mpg files in a directory automatically using ubuntu 8.10 Server
#! /usr/bin/perl -wl
use strict;
use warnings;
my$file;
my $dir = "/media/";
opendir(BIN, $dir) or die "Can't open $dir: $!";
my $newfile;
my $origfile;
while( defined ($file = readdir BIN) ) {
chomp ($file);
my $filex;
my @parts = split (/\./,$file);
$filex = $parts[1];
pop @parts;
my $file_no_ext = join '.', @parts;
$newfile = "\"".$dir.$file_no_ext . ".mp4"."\"";
$origfile = "\"".$dir.$file."\"";
my $runcommand = "ffmpeg -i $origfile -target ntsc-vcd $newfile";
if ($filex eq "mpg")
{
system($runcommand);
}
}
closedir(BIN);
#! /usr/bin/perl -wl
use strict;
use warnings;
my$file;
my $dir = "/media/";
opendir(BIN, $dir) or die "Can't open $dir: $!";
my $newfile;
my $origfile;
while( defined ($file = readdir BIN) ) {
chomp ($file);
my $filex;
my @parts = split (/\./,$file);
$filex = $parts[1];
pop @parts;
my $file_no_ext = join '.', @parts;
$newfile = "\"".$dir.$file_no_ext . ".mp4"."\"";
$origfile = "\"".$dir.$file."\"";
my $runcommand = "ffmpeg -i $origfile -target ntsc-vcd $newfile";
if ($filex eq "mpg")
{
system($runcommand);
}
}
closedir(BIN);