Morgan Davis

Loading

Usage: Start a PowerShell, drop into a directory containing flac music files, and then run this flac2mp3.ps1 script. It will find all the *.flac files in the current directory and encode them as *.mp3 files (adjust arguments as desired). Requires both the flac and lame command line tools.

File: flac2mp3.ps1


$flac = "c:\program files\flac\flac"
$lame = "c:\program files\lame\lame"
$tmp = "flac2mp3temp.wav"

foreach ($f in gci *.flac) {
    $f.name -match "(^.+)\..+"
    $fn = $matches[1]
    & $flac -d "$f" -o $tmp
    & $lame -b 320 -h -m s $tmp "$fn.mp3"
    remove-item $tmp
}

Add a Comment