I'm just wondering if someone wrote a perl script to convert a directory with flac files into mp3 and preserving the id3 tag from flac to mp3? I have two harddrives where I keep my favorite CDs in flac and others in mp3 but when I get tired of them, I move them into mp3 and rather than popping the original CD in, it might be easier to just convert from flac to mp3 directly. Please cc me on your reply. clambert@sgi.com Let me know
Thanks this is exactly what I was looking for. Just one tip for you, you might want to look into just using the lame --alt-preset fast standard if you want to get the best quality for VBR. Those are preset flags that the lame engineer themselves found to give the best results for the bitrate. If you want bigger filesize, use the "extreme" preset. You don't specify any other command line but just that. It's similar to the outdated --r3mix command line (see www.r3mix.net). -Christian Jason L. Cook wrote: | |Here's an extremely quick-and-dirty Perl script I wrote to do just that. |This script depends on having the MP3::Info Perl module for ID3 tag |information, and assumes that you have lame set up. It will take a flac |file (or a wildcard) as an argument, decompress that file, and encode it |as a fairly high-bitrate VBR MP3. | |I want to stress that this is just something I wrote for my needs, so it |outputs filenames the way I like them, and assumes a great deal about |the environment in which it's run. | |Hope this helps... | |Cheers, | -Jason | | |Christian Lambert wrote: | |>I'm just wondering if someone wrote a perl script to convert |>a directory with flac files into mp3 and preserving the id3 tag |>from flac to mp3? |> |>I have two harddrives where I keep my favorite CDs in flac and others in mp3 but |>when I get tired of them, I move them into mp3 and rather than popping the |>original CD in, it might be easier to just convert from flac to mp3 directly. |> |>Please cc me on your reply. clambert@sgi.com |> |>Let me know |> |> |>_______________________________________________ |>Flac-dev mailing list |>Flac-dev@lists.sourceforge.net |>https://lists.sourceforge.net/lists/listinfo/flac-dev |> | | |
Here's an extremely quick-and-dirty Perl script I wrote to do just that. This script depends on having the MP3::Info Perl module for ID3 tag information, and assumes that you have lame set up. It will take a flac file (or a wildcard) as an argument, decompress that file, and encode it as a fairly high-bitrate VBR MP3. I want to stress that this is just something I wrote for my needs, so it outputs filenames the way I like them, and assumes a great deal about the environment in which it's run. Hope this helps... Cheers, -Jason Christian Lambert wrote:>I'm just wondering if someone wrote a perl script to convert >a directory with flac files into mp3 and preserving the id3 tag >from flac to mp3? > >I have two harddrives where I keep my favorite CDs in flac and others in mp3 but >when I get tired of them, I move them into mp3 and rather than popping the >original CD in, it might be easier to just convert from flac to mp3 directly. > >Please cc me on your reply. clambert@sgi.com > >Let me know > > >_______________________________________________ >Flac-dev mailing list >Flac-dev@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/flac-dev >-------------- next part -------------- #!/usr/bin/perl use MP3::Info; foreach $file (@ARGV) { if (!($file =~ /\.flac$/)) { print "Skipping $file\n"; next; } if ($tag = get_mp3tag($file)) { $artist = $tag->{ARTIST}; $title = $tag->{TITLE}; $album = $tag->{ALBUM}; $track = $tag->{TRACKNUM}; chomp($artist); chomp($title); chomp($album); chomp($track); $track = sprintf("%2.2d", $track); } else { print "Couldn't get MP3 tag for $file.\n"; } `flac -d "$file"`; $file =~ s/\.flac$/.wav/; if (($artist) && ($title) && ($track)) { $outfile = "$artist - ($track)$title.mp3"; } else { $outfile = $file; $outfile =~ s/\.wav$/.mp3/; } `lame -V -b128 -B256 --tt "$title" --ta "$artist" --tl "$album" --tn $track "$file" "$outfile"`; `rm "$file"`; print "-------------------------------------------\n"; }