FLAC to MP3, without babysitting it
I had a small, recurring annoyance in my music collection: FLAC files would turn up, sometimes added automatically, and I wanted MP3s instead. Converting a folder once is easy enough. Remembering to do it again every time something new arrives? That's the bit I wanted to stop doing.
Normally I'd put something like this in a Docker container and forget about it. But my Docker host has a very weak CPU. It's quite happy running lots of containers, as long as none of them ask it to do any actual heavy lifting. Audio conversion definitely counts.
My workstation, on the other hand, has the CPU for it. So I wrote flac-to-mp3-transcoder, a PowerShell module that runs on Windows and Linux. I use it as a scheduled task on my workstation: it looks through the music folders, including subfolders, and converts whatever FLACs have arrived since the last run. You can just kick it off manually, too. It doesn't need to sit there running all day.
I wanted something I could trust with my collection, not just a quick loop around FFmpeg. It checks the finished MP3 before deleting the FLAC, won't overwrite an existing MP3, and has automated tests covering conversion, conflicts, and recovery. Supported tags and album art come along for the ride.
This replaces the FLACs; it doesn't keep a second copy. MP3 is lossy, so keep a separate backup if you want the originals. Try it on a disposable folder before pointing it at your collection, especially on a network share.
Give it a go
You'll need PowerShell (7+ on Linux; 5.1 or newer on Windows), plus FFmpeg and ffprobe on your PATH. Run these examples in PowerShell.
Clone the project and load the module:
git clone https://github.com/Winfred-zz/flac-to-mp3-transcoder.git
Set-Location ./flac-to-mp3-transcoder
Import-Module ./flac-to-mp3-transcoder.psd1
First, see what it would convert. -WhatIf leaves your files alone:
Happy with the preview? Run it for real. It'll ask before converting each file:
On Linux, use your music folder's path instead, such as /home/you/Music. For an unattended manual run, add -Confirm:$false once you've checked the preview and tried a real conversion.
Let the workstation remember
From the project directory, run the guided setup to save your music folders and settings. Then install a Windows scheduled task; this example runs daily at 7pm:
On Linux, run ./setup.ps1 first, then install a user systemd timer instead:
Scheduled runs don't ask for confirmation. Make sure the account running the job can read, write, and delete files in your music folders. Linux user timers also need a running user systemd manager; the scheduling guides cover that and the other setup details.
That's the whole idea: let the workstation do the work, and leave the little Docker host alone.