.flac to .ogg
Eric
235u at comcast.net
Mon Jul 19 19:26:00 EDT 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brendan wrote:
| To answer Eric's original question, flac2ogg is available. You need
what it
| says it needs:
|
| #! /usr/bin/perl
|
| ##########################################
| # flac/shorten to ogg vorbis converter
| # stuff needed to run: shntool, vorbis-tools, flac
| # USE: "perl flac2ogg.pl"
| ###########################################
| # copyright (c) 2004 stateq2
| # flac2ogg is released under the GPL.
| # http://www.gnu.org/copyleft/gpl.html
| ############################################
| # version 0.5
| ###########################################
| # to do:
| # have vorbis files outputted in same dir style as originals
| ############################################
| use File::Find;
|
| print "enter the dir containing .shn/.flac files to be converted: ";
| chop ($src_dir=<STDIN>);
| print "\nenter the dir where you want the output(ogg's) to go: ";
| chop ($out_dir=<STDIN>);
| print "\nchoose a quality setting for the ogg vorbis files...\n";
| print "(6 is a good choice for great quality and moderate filesize)\n\n";
| print "0 ~= 64kbps | 5 ~= 160kbps | 10 ~= 400kbps\n";
| print "choose(0-10): ";
| chop ($ogg_qual=<STDIN>);
| print "\n";
|
| find(\&files, $src_dir);
|
| sub files {
|
| $orig_file=$_;
|
| if (($orig_file !~ /\.flac$/i) && ($orig_file !~ /\.shn$/i))
{next};
| print "Checking file: $orig_file\n";
|
| # if the file is .flac, convert it to .ogg
| if ($orig_file =~ /\.flac$/i) {
| $new_ogg_file=$orig_file;$new_ogg_file=~s/\.flac/\.ogg/;
| $flac_to_ogg=`oggenc -q$ogg_qual
| \"$File::Find::dir/$orig_file\" -o \"$out_dir/$new_ogg_file\"`;
| print "1. FLAC-->OGG VORBIS: $flac_to_ogg\n";
| $cmd=`$flac_to_ogg`;
| print "\n\n";
| }
|
| # else, if the file is .shn, conver it to .wav, convert .wav to .ogg,
then
| delete wav
| elsif ($orig_file =~ /\.shn$/i) {
| $new_wav_file=$orig_file;$new_wav_file=~s/\.shn/\.wav/;
| $convert_to_wav=`find \"$File::Find::dir\" -iname
| \"$orig_file\" | shntool conv -o wav -d \"$out_dir\"`;
| print "1. SHN-->WAV: $convert_to_wav\n";
| $cmd=`$convert_to_wav`;
| if ($new_wav_file !~ /\.wav$/i) {next};
| $new_ogg_file=$new_wav_file;$new_ogg_file=~s/\.wav/\.ogg/;
| $wav_to_ogg="oggenc -q$ogg_qual
\"$out_dir/$new_wav_file\"";
| $remove_wav="rm -rf \"$out_dir/$new_wav_file\"";
| print "2. WAV-->OGG VORBIS: $wav_to_ogg\n";
| $cmd=`$wav_to_ogg`;
| print "DELETE WAV: $remove_wav\n";
| $cmd=`$remove_wav`;
| print "\n\n";
| }
| }
|
| print "flac2ogg is done\n"
Hi. I finally have some time to play around with my audio files but I'm
getting these errors. Any ideas?
[eric at playpen110 eric]$ perl /home/eric/myMusic/flac2ogg.pl
syntax error at /home/eric/myMusic/flac2ogg.pl line 51, near "wav
~ elsif"
syntax error at /home/eric/myMusic/flac2ogg.pl line 67, near "}"
Execution of /home/eric/myMusic/flac2ogg.pl aborted due to compilation
errors.
Thanks,
- --
- -Eric
http://caffeinated.webhop.net/
"If you have any trouble sounding condescending, find a Unix user
to show you how." Some Dilbert cartoon.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFA/Fm/txY9EH9Ev80RAv38AJ9WMhpCh8ertH2a1YWwaetNPpCttQCgmEZz
Hq2157/8KOwDMdfjc3swC8s=
=5Q5J
-----END PGP SIGNATURE-----
More information about the Discuss
mailing list