#!/usr/bin/perl -w ################################################################# # ogg2mp3.pl - convert ogg to mp3 (requires lame). # # Description : takes a directory containing .ogg files and # a prefix to what you would like the mp3s. # # Usage: perl ogg2mp3.pl # ################################################################# my( $directory, $prefix) = @ARGV; if($#ARGV < 1) { print "USAGE : ogg2mpf \n"; exit; } opendir(DIR, $directory) || die "Can not open $directory\n"; push(@files, grep { $_=~/\.ogg/ } readdir DIR); close DIR; my $counter = 1; foreach $file (sort @files) { $oggfile = $directory . "/" . $file; my $mp3file = $directory . "/" . $prefix . "-" . $counter . ".mp3"; $counter++; print "Convert ogg file ( $file ) to mp3 file ( $mp3file )\n"; system "ogg123 -d wav -f - $oggfile | lame -v -V 0 - $mp3file"; }