flac2mp3: batch flac to mp3 converter

Here is a quick script I whipped together to convert flac files to mp3. Its nothing fancy but it does the job. Doesnt require anything but flac and lame.

I was going to include a bunch of fancy id3 tag stuff but to be honest most of the id3 perl libraries out there arent that great to use. I may do something like that in the future though. Since I use quod libet which has a fantastic tagger built in, it isnt really an issue for me.


#!/usr/bin/perl

$lame_opt = "--preset extreme";

foreach (@ARGV) {
if (!($_ =~ /\.flac$/)) {
print "Skipping $_\n";
next;
}

`flac -d "$_"`;
$_ =~ s/\.flac$/.wav/;
$target = $_;
$target =~ s/\.wav$/.mp3/;
`lame $lame_opt "$_" "$target"`;
`rm "$_"`;
}

Convert firmware images from .bin to .trx

You may on occasion have a need to convert .bin firmware images such as those used to flash linksys based devices into .trx formatted images that can be accepted by OpenWRT. Its actually quite easy to do:

dd if=image.bin of=image.trx bs=32 skip=1

That will strip the first 32 bytes off the image, thus making it a valid .trx formatted firmware image file. Neat, huh?