Converting FLAC files on Windows, or, "How I use ffmpeg to rule the world"


I had some FLAC audio files on my computer that I wanted to convert to a lossy format (AAC, in my case). iTunes won't play FLAC, and VLC wasn't helping me. I ended up calling FFmpeg in a PowerShell script to quickly convert all of the files.

$target = 'J:\FLAC'
$target = $target + "\*.flac"
$files = Get-ChildItem $target

foreach ($file in $files) {
    .\ffmpeg.exe -i $file -acodec libvo_aacenc -b:a 256k -ar 44100 -threads 4 -n $($file.BaseName + ".m4a")

One of the several issues I ran into was trying to use an FFmpeg frontend. The particular one I tried was limited to a certain maximum AAC bitrate output. So the vanilla FFmpeg worked just fine, and I didn't have to do anything special to get it to work.