When I'm trying to encode files with lame, most of the time it gives up
somewhere between about 5% and 20% completion, without giving any kind
of error message.
I'm encoding raw pcm files which were ripped using cdparanoia, and lame
3.92 was compiled using gcc 2.95.3. I'm not passing any options to lame
apart from id3 tag options (--tt, --ta, --tl, --td, --tn). I tried
encoding wav files instead, but the same thing happened. The wav files
all played fine in KDE Media Player though.
I wrote a couple of small perl scripts to do the ripping and encoding,
which I have attached, so you can see if perhaps I'm doing something
wrong there. They are the first perl scripts I've ever written, so
there's a good chance I've messed up there. (I hope attachments are
allowed. If not, I won't do it again).
--
Cheers
James Ots
#!/usr/bin/perl -w
$cddbserver = "freedb.org";
$cddevice = "/dev/cdrom";
$ripdevice = "/dev/scd0";
$cddiscid = "/usr/local/bin/cd-discid";
$lame = "/usr/local/bin/lame";
$id3ed = "/usr/bin/id3ed";
$cdparanoia = "/usr/bin/cdparanoia";
$cddbcmd = "/usr/X11R6/bin/cddbcmd";
sub stripnl {
$param = $_[0];
$param =~ /([^\n]*)/;
return $1;
}
sub isanumber {
return !(($_[0] == 0) && ($_[0] ne "0"));
}
open(DISCINFO, "discinfo") or die("Can't open file $!");
while($line=<DISCINFO>) {
if ($line =~ m/DTITLE *= *([^\/]*) *\/ *(.*) */) {
$artist = $1;
$title = $2;
}
if ($line =~ m/TTITLE([0-9]*) *= *(.*)/) {
$tracks[$1] = $2;
}
if ($line =~ m/CATEGORY *= *(.*) */) {
$category = $1;
}
}
close(DISCINFO);
print "Artist: $artist\n";
print "Title: $title\n";
for ($i=0; $i<=$#tracks; $i++) {
printf "%2d",$i+1;
print " $tracks[$i]\n";
}
# now rip the cd and use the titles for the tracks
for ($i=1; $i<=$#tracks+1; $i++) {
$trackname=sprintf "track%2.2d.cdda.raw",$i;
$newtrack=sprintf "%2.2d %s.mp3",$i,$tracks[$i-1];
`$lame --tt "$tracks[$i-1]" --ta "$artist" --tl "$title" --tg "$category" --tn $i "$trackname"`;
`mv "$trackname.mp3" "$newtrack"`;
}
#!/usr/bin/perl -w
$user = "james:users";
$cddbserver = "freedb.org";
$cddevice = "/dev/cdrom";
$ripdevice = "/dev/scd0";
$cddiscid = "/usr/local/bin/cd-discid";
$lame = "/usr/local/bin/lame";
$id3ed = "/usr/bin/id3ed";
$cdparanoia = "/usr/bin/cdparanoia";
$cddbcmd = "/usr/X11R6/bin/cddbcmd";
sub stripnl {
$param = $_[0];
$param =~ /([^\n]*)/;
return $1;
}
sub isanumber {
return !(($_[0] == 0) && ($_[0] ne "0"));
}
#@categories = `cddbcmd -h $cddbserver CDDB LSCAT`;
$discid = `$cddiscid $cddevice`;
print "Looking up cd...\n";
@cds = `$cddbcmd -h $cddbserver CDDB QUERY $discid`;
print "Found ".($#cds+1)." possible match".($#cds>0?"es":"").":\n";
for ($i=0; $i<=$#cds; $i++) {
$cds[$i] =~ /^([^ ]*) [^ ]* (.*)/;
print $i+1;
print " $2 [$1]\n";
}
print "0 None of the above\n";
do {
print "Which CD? ";
$line = <STDIN>;
$line = stripnl($line);
} until isanumber($line) && ($line <= ($#cds+1)) && ($line >= 0);
$line = int($line);
if ($line==0) {
print "CD adding not implemented. Exiting.\n";
exit;
}
$line=$line-1;
$cds[$line] =~ /^([^ ]*) ([^ ]*) /;
$category = $1;
$realid = $2;
print "Looking up details...\n";
@discinfo = `$cddbcmd -h $cddbserver CDDB READ $category $realid`;
for ($i=0; $i<=$#discinfo; $i++) {
if ($discinfo[$i] =~ m/DTITLE *= *([^\/]*) *\/ *(.*) */) {
$artist = $1;
$title = $2;
}
if ($discinfo[$i] =~ m/TTITLE([0-9]*) *= *(.*)/) {
$tracks[$1] = $2;
}
}
print "Artist: $artist\n";
print "Title: $title\n";
for ($i=0; $i<=$#tracks; $i++) {
printf "%2d",$i+1;
print " $tracks[$i]\n";
}
mkdir $artist;
`chown $user "$artist"`;
chdir $artist;
mkdir $title;
`chown $user "$title"`;
chdir $title;
open(DISCINFO, "> discinfo") or die("Can't open discinfo file $!");
for ($i=0; $i<=$#discinfo; $i++) {
print DISCINFO $discinfo[$i];
}
print DISCINFO "CATEGORY=$category";
close(DISCINFO);
`$cdparanoia -B -p -S 40 -d $ripdevice 1-`;
`chown $user *`;
chdir "../..";