On Sat, 2003-06-07 at 22:06, Rob Blomquist wrote:
> On Friday 06 June 2003 11:31 pm, Rob Blomquist wrote:
> > I regualrily download streaming-mp3 files with XMMS. And I want to clean
> > them up with Audacity, but above about 20Mb it crashes while loading the
> > file. For the record my machine is a AMD 2100+ with 512 Mb of RAM and about
> > 2Gb free under /home.
> >
> > I really need to edit mp3s up to about 1 hour in length, which would
> > require about 70Mb files.
> >
> > Any ideas on how to edit them? Console would be fine, too, just so long as
> > I have an indexing method to find the start and stop positions.
> 
> I figured it out. I used "lame -decode" to convert the file (in this case only 
> about 41Mb to a wav file of 617Mb then uploaded it into Audacity without a 
> hitch.

wow. Sucks to have to go through that, both for quality loss and for
time spent, but I'm glad you found a workaround. If you've got to spend
any serious time on it, here's a script I've been using. I've cleaned up
the original some, and it could use a ton more cleanup, but...
-- 
Jack Coates
Monkeynoodle: A Scientific Venture...
http://www.monkeynoodle.org/resume.html
#!/usr/bin/perl

# ver 0.06
# If you are looking for the TEMPDIR setting
# scroll down a bit :)

# mp3recode is a quick and dirty script to
# re-encode mp3's which fall below a certain
# bitrate (in this case 128).  It will determine
# which mp3's fall below this rate, and re-encode them
# to a specified bitrate. It moves the 'old' mp3
# to a temporary directory.

# thanks to Boort for his contibuted renaming function

# this script is released under the GPL

# USAGE

# mp3recode <rate-cap> <new encode rate>

# Begin

use MPEG::MP3Info;

# check is the bitrate -below which- you want
# a re-encode to take place

$check=$ARGV[0];

if (!($check)){
	$check=128;
	}

# rate_out is the rate in which the 
# mp3 is re-encoded. It defaults to
# 128 (thus all files below 128
# are re-encoded for 128)

# YES, this does increase the filesize with
# NO increase in quality-- but many situations
# call for minimally a 128 encode.
	
$rate_out=$ARGV[1];

if (!($rate_out)){
	
	$rate_out=128;
}
			
######### Temp Dir ########

# Mp3recode moves the 'old' mp3's to 
# a safe location for safety sake

# CHANGE the BELOW to a temp
# directory to store the old mp3's
# MAKE sure to include a trailing "/"
# example: /home/foo/temp/

$tempdir="/home/jack/tmp/";

if (!($tempdir)){
	        print "Edit mp3recode.pl and set a temp directory!\n";
		exit;        
		}

# whatever options for lame you desire, slap here
# the default is for high quaility, at 128kb/sec.
# if you want to alter the re-encode bitrate, change
# the -b $check to whatever.  BE aware, lower encoded
# mp3's will probably not be able to be re-encoded
# at a rate higher than 128 unless they have a frequency
# higher than 22.05

$lame_opts="lame -h -b $rate_out";

# nasty filenames can cause problems
# belows is a modification of rajak's
# quick and dirty renamer. Renames
# spaces, ()'s, and "'"'s.

foreach $xold (`ls *.mp3`){
	  chomp $xold;
	  $xnew = $xold;
	  $xn = $xold;
	  $xnew = lc($xn);          ## lowercase it
	  $xnew =~ s/\%20/_/g;      ## Converts netscape screwup to a _
	  $xnew =~ s/\ /_/g;        ## Converts space to a _
	  $xnew =~ s/\(/-/g;        ## Removes ( and subs -
	  $xnew =~ s/\)//g;         ## Removes )
	  $xnew =~ s/\[/-/g;        ## Removes [ and subs -
	  $xnew =~ s/\]//g;         ## Removes ]
	  $xnew =~ s/\{/-/g;        ## Removes { and subs -
	  $xnew =~ s/\}//g;         ## Removes }
	  $xnew =~ s/\#//g;         ## Removes #
	  $xnew =~ s/\!//g;         ## Removes !
	  $xnew =~ s/\~//g;         ## Removes ~
	  $xnew =~ s/\'//g;         ## Hickey remover
	  $xnew =~ s/_-_/-/g;       ## Shorten _-_ to -
	  $xnew =~ s/-*-/-/g;       ## Shorten 2 or more -- to 1 -
	  $xnew =~ s/_*_/_/g;       ## Shorten 2 or more __ to 1 _
	  $xnew =~ s/-_/-/g;        ## Clean up -_ to -
	  $xnew =~ s/\&/\+/g;       ## Clean up & for eaiser use in unix
	  $xnew =~ s/\,_/\+/g;      ## Set up for format artist1+artist2
	  $xnew =~ s/_\+_/\+/g;     ## Shorten _+_ to +
	  $xnew =~ s/_-/-/g;        ## Clean up _- to -
	  $xnew =~ s/-\./\./g;      ## Remove extra -'s infront of .mp3
	  $xnew =~ s/\.-/\./g;      ## Remove extra -'s behind a  dot
	  $xnew =~ s/\._/\./g;      ## Remove extra _'s behind a  dot
	  $xnew =~ s/^-//g;         ## Remove - at beginning of filename
	  $xnew =~ s/^_//g;         ## Remove _ at beginning of filename
	  $xnew =~ s/^\.//g;        ## Unhide files
		    
		    if($xnew ne $xold){
				print "Renaming $xold to $xnew\n";
				rename $xold, $xnew or die "Failed renaming $xold\n";
		    }
}

# Misc variables and main loop

# Hat's off to Ralf D. Werner, who contributed
# a modification which preserves ID3tag info
# (in this case only the artist and title)

while($file =  <*.mp3> ) {
        my $info1 = get_mp3info($file);
        my $rate= ($info1->{BITRATE});
        my $freq= ($info1->{FREQUENCY});
        my $info2 = get_mp3tag($file);
        my $artist= ($info2->{ARTIST});
        my $title= ($info2->{TITLE});
        my $year= ($info2->{YEAR});
        my $album= ($info2->{ALBUM});

        my $tag_cmd = "--tt \"$title\" --ta \"$artist\"";

        $freq=($freq*1000);
		if ($rate == $rate_out){
			next;
		}
                if ($rate < $check){
                        $file =~ s/\/.*\///;
                        printf "$file\'s bitrate is %d", $rate;
                        print "\n";
                        print "Re-encoding $file\n";
                        $file_out=$file;
                        $file_out =~ s/mp3$/tmp/;
                        $file_recode=$file_out;
                        $file_recode=~s/.tmp/.new.mp3/;
			print "$file frequency is $freq\n";
			$lame="$lame_opts -s $freq --mp3input";			
			system ("$lame $tag_cmd $file $file_recode");
			rename "$file", "$tempdir$file";
                        rename "$file_recode", "$file";

                }

        }


Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to