[Flac] Batch Process for wav->flac?

Frank Russo russofris at hotmail.com
Thu Jun 1 18:03:07 PDT 2006


Also, If using perl, you can convert between formats quite easily (aac, 
flac,ape,wav,etc)...

Someone re-read this as I don't have an installation to test this on at the 
moment.

Copy/paste into convert.pl and run
>perl convert.pl c:\mydirectory aac
or
>perl convert.pl c:\mydirectory mp4
or something


Change the following lines to suite your needs
               faad   $noext.aac $noext.wav
               flac -8  $noext.wav


----------------------------------------------------------------------------------
#!/usr/bin/perl -w

use strict;

# --- grab dir and filter from cmd line ---
my $dir    = shift @ARGV || '.';     # default to .
my $filter = shift @ARGV || '*.aac'; # default to *.aac

# --- run 'find', break into array ---
my @find = split /\n/, `find $dir -type f -name "$filter"`;

# --- process each file ---
foreach my $file (@find) {
      $file =~ s/([^\w\.\/-_,])/\$1/g;              # escape non-word chars
      my $noext = ($file =~ /^(.*)\..*?$/)[0] || ''; # get filename w/o ext

      # --- customize this to your needs ---
      my $cmd = qq[

               faad   $noext.aac $noext.wav
               flac -8  $noext.wav

              # rm $file $noext.wav # uncomment when you know the previous 
cmds work
      ];

      print $cmd;     # display what we're gonna run (optional)
      #print `$cmd`; # run it (uncomment when ready)
}




>From: "Frank Russo" <russofris at hotmail.com>
>To: mgreig1 at lsu.edu, flac at xiph.org
>Subject: RE: [Flac] Batch Process for wav->flac?
>Date: Thu, 01 Jun 2006 17:37:00 -0700
>
>In linux.....  Something like
>-----------------------------------------------------------------
>for FOO in `ls -R | grep wav` ; do flac -5 ${FOO} ; done
>----------------------------------------------------------------
>or
>--------------------------------------------------------------
>find . -name "*.wav" | while read FOO
>do
>        flac -5 "${FOO}"
>done
>---------------------------------------------------------------
>
>Now, if you're using winders, All I can do is give you some perl
>
>---------------------------------------------------
>#!/usr/bin/perl -w
>
>use strict;
>
>my $dir = shift @ARGV;
>
>opendir DIR, $dir;
>while (my $file = readdir(DIR)) {
>	next unless $file =~ /wav$/;
>	my $cmd = qq[flac -8 "$file" ];
>	print "$cmd\n";
>	print `$cmd`;
>}
>closedir DIR;
>-----------------------------------------------------------------------------
>
>>From: "Matthew Greig" <mgreig1 at lsu.edu>
>>To: <flac at xiph.org>
>>Subject: [Flac] Batch Process for wav->flac?
>>Date: Thu, 1 Jun 2006 18:55:31 -0500
>>
>>I have a hard disk full of live shows.  Each show is in an individual 
>>folder
>>(titled by name and date of show), and contains the individual wav files 
>>of
>>the show, labeled "disc1track1, disc1track2, etc."  It's the same naming
>>scheme in each of the 200 or so folders for each show.
>>
>>
>>
>>I want to convert each audio file to flac - is there a way to do this all 
>>at
>>once?  I can't just copy and paste each file into the frontend because 
>>they
>>share file names.  What would be ideal is some way to add the folders to a
>>list, and have it encode any audio files found in each folder.  Thanks!
>>
>
>
>>_______________________________________________
>>Flac mailing list
>>Flac at xiph.org
>>http://lists.xiph.org/mailman/listinfo/flac
>
>
>_______________________________________________
>Flac mailing list
>Flac at xiph.org
>http://lists.xiph.org/mailman/listinfo/flac




More information about the Flac mailing list