Bulk Convert Follow-Up

Two things have changed.  I decided to undelete the whole WMA library and re-convert to 320kbps instead of 192kbps.

Second; Plex has decided to shut down the service for which I was preparing my music.  I don’t know what I’ll do next but I will make updates as I find out more.

Here’s the new script for the conversion.  It takes care of the square brackets, long file/paths, and some other stuff.

$m = "\\?\C:\Users\jason\OneDrive\Music\"

Get-ChildItem -Path $m -Filter '*[*' -Recurse | % {Rename-Item -LiteralPath $_.fullname -NewName $_.fullname.replace("[","(")}
Get-ChildItem -Path $m -Filter '*]*' -Recurse | % {Rename-Item -LiteralPath $_.fullname -NewName $_.fullname.replace("]",")")}

$batchtoconvert = gci -LiteralPath $m -Filter *.wma -Recurse


foreach ($filename in $batchtoconvert)
    write-host $filename.FullName
    $st = get-date
    $input = $filename.FullName
    $output = $filename.FullName -replace ".wma", ".mp3"
    & "C:\Users\jason\OneDrive\Documents\ffmpeg\bin\ffmpeg.exe" -i $input -ab 320k -map_metadata 0 -id3v2_version 3 $output -y -loglevel panic
    $et = get-date
    $ts = [DateTime]$et - [DateTime]$st
    write-host $ts.seconds " seconds"
    Remove-Item $filename.FullName -Force

Bulk Convert WMA to MP3

Don’t care about the what or why?  Skip to the how below.

Many years ago, I decided that lossless WMA was going to be the wave of the future.  My Creative Labs Zen played them beautifully when the world still hadn’t accepted FLAC.

It was a weird time for music.  Ipods weren’t a thing yet and the world didn’t know what to do with digital music.  Solid storage was impractically expensive and almost no MP3 players had it.  If they did, 64 megabytes of flash storage was equivalent to a 500 megabytes of magnetic disk storage.

Basically the answer was to go backward from everything we worked toward to have our home audio closely match the real thing and use absolute crap quality, highly compressed audio files so we could carry them to the gym.  Disgusting.

I did my research way back then and I believe my argument for the lossless WMA was both that WMP ripped them quicker than lossless MP3s and, more interestingly, supposedly it was less disk access to read them.  Think about it this way – highly compressed media needs to be decompressed.  This uses processing power and battery.  Less compression (or zero compression) only needs to be read from the disk, quickly interpreted, and then turned into audio.

Back in 2003-ish, I was convinced of this and ripped tons of my personal CDs into WMAs.  Eventually the Zune popped up and though it will be forever mocked, was a solid MP3 player.  It handled WMAs just fine so I still felt comfortable with my decision made a decade prior.

Later on, post Zune, I had a Windows Phone which, again, played WMAs without any issue.  Eventually I moved away from that (forcefully) and am now on an Android.  Androids can play WMA files just fine and Microsoft’s Groove player did a fine job of that.  Still, fifteen years later, I felt like it was a fine decision.  More so now that my files were stored online and bandwidth isn’t even a consideration any longer.

Recently Microsoft announced a plan to sunset (kill) the Groove player on all platforms except Microsoft platforms.  Unfortunately this left me in a rut as the final kill will happen in a few months and I’d still like to listen to these.

Plex has a cloud service that, well, sucks.  It’s supposed to read the files from your OneDrive account and give you a serverless playback option.  It works great with MP3 files but struggles greatly with WMAs regardless of platform.  I looked for many other options and everything seems to struggle.  I don’t know if it’s an on-fly conversion or some caching issue but WMAs are a thing of the past and I’m accepting that my twenty-year-ago decision was the wrong one.

But to be fair, nobody knew what would happen.

Being in OneDrive, it’s easy to sync up my library.  I recently went through the process of converting all of the WMA files into 192kb MP3 files.  File sizes shrank drastically as did quality.  I wasn’t looking to save space, I was looking to stream my music reliably and file size is important.


If you’re like me and you keep your music up on OneDrive and want to play it anywhere at any time, give this a try.  What I’m using:

  • Windows 10
  • OneDrive (built in)
  • Plex Cloud
  • PowerShell (built in)
  • ffmpeg

First off, you’ll need to download all of the WMAs.  My collection has a combination of many file types collected over eighteen years but we’ll convert these.

Mine are all gone so here’s a dummy.  Select all (ctrl + a) and right click, choose “Always keep on this device”.  This will start the OneDrive mega sync.  All of the WMA files, regardless of folder within your “music” folder, will begin to download.  This was about 60GB for me.

Then you wait.  Go download ffmpeg while you wait and extract it somewhere.  It doesn’t need to be installed.

Find the directory of the “ffmpeg.exe” file.  This is the tool that we’ll use to do the conversions.

Next we’re going to open up PowerShell.  I’ve written the script here.  It’s sloppy but it works and we’re not going for anything permanent.  Here’s the script.

$m = "C:\users\jason\OneDrive\Music\*"
#$m = "\\?\C:\users\jason\OneDrive\Music\*"

$batchtoconvert = gci -Path $m -Filter *.wma -Recurse

foreach ($filename in $batchtoconvert)
	write-host $filename.FullName
	$st = get-date
	$input = $filename.FullName
	$output = $filename.FullName -replace ".wma", ".mp3"
	& "C:\PATHTOFFMPEG\bin\ffmpeg.exe" -i $input -ab 192k -map_metadata 0 -id3v2_version 3 $output -y -loglevel panic
	$et = get-date
	$ts = [DateTime]$et - [DateTime]$st
	write-host $ts.seconds " seconds"
	Remove-Item $filename.FullName -Force

What’s it do?  We’ll go through it.

To get PowerShell open on a Windows computer, push WindowKey + R, type “powershell ise”, and push enter.  Copy/paste that script into the TOP window.

The first line is the main path of your music folder.  Under this, in any subfolder, you’ll have your WMA files.

The second line is to be used if paths get REALLY LONG.  It might be best to use this instead.  The pound symbol is a comment.

The next chunk says “give me a list of WMA files in all of these directories and sub directories”.

Then we get to the loop.  The next thing you need to change is that c:\PATHOFFFMPEG\.  Make sure to put the path of the ffmpeg.exe file you downloaded from the website earlier.

What this will do is take each one, name by name, and convert it a 192kb MP3 file, preserving the metadata and embedded album art on the way.  Cool!  It will also remove the WMA file (if it can – more on that below) so that the MP3 can effectively take its place.

To run it, highlight the whole text and push F8.

I recommend testing a few at a time.  You explicitly specify a directory to convert or even a whole letter.  I did my collection letter by letter with “…\A*” to get all the A’s.  This was not necessary but I worry about things and my computer is pushing seven years old so I wanted to keep an eye on it.

I actually ran two instances of PowerShell and ran a letter of the alphabet in each one.  T and S took the longest and it let more cores do more work.

A few caveats that could be fixed if you wanted to spend the time fixing them:

Paths that are too long will break it.  If it simply doesn’t work from the start, try a shorter or more explicit directory and see if that works.  You might have some long stuff.  You can also try using the “\\?\” syntax in front of the path to hint at the long paths.  If you have bad habits about giving paths crazy deep or long names, this can be a problem.  Play around with it.

Second, if a file or folder has [square brackets] anywhere, it will break the delete part of the script because I never bothered to escape them.  What I recommend is either write that in yourself (haha) or after you’re all converted, do another search for all the remaining WMA files.  You might notice that they all have a square bracket somewhere.  You can bulk delete them this way.  This won’t prevent them from being converted, just deleted.

Third and what should have been at the very top of this post: do this at your own risk.  You’re deleting your old WMAs, replacing them with MP3s, and eating a ton of bandwidth on the way.

  • OneDrive will go into frantic scan and upload mode during this process if you do it in the live sync’d directory.  Let it.
  • You will break your old playlists because they likely depended on the other filenames.
  • OneDrive will keep everything deleted for at least a month in the online recycle bin.  If everything gets really screwed up, you can bring back your old stuff.
  • KEEP YOUR MEDIA PLAYER CLOSED!  If it’s trying to scan this stuff while you do this, you’re going to make it vomit.
  • Be patient.

If this all works out for you, Plex offers a cloud player that will supposedly grab your files from OneDrive and play them anywhere you can install the app.  It works on Windows, Android handhelds and TVs, and the website.  It’s a great app but their handling of the streaming is sub-par.  I don’t recommend Plex right now but when the next thing comes around, the MP3 files will most likely be where the world wants you to be.  This time, I’ll be ready.

I’m considering a hosted personal server.  If I go that route, I’ll share all Linux commands and the scripting along the way.

Expect a follow up post in 2034 with the “I was wrong again – here’s how to really do it” explanation.

Have fun.

Birthdays and Sneezes

Happy birthday first of all to my four-year-old Sarah, going on sixteen.  Her party was fun and I think we pulled it off well.  A week later and we still have half a vegetable try to get through but the remainder of the leftovers served as meals all week.

Pop and baby sister each turned a year older near the end of this week.  Three August birthdays over five days in our family.  It was great having grandma out.  The Amtrak delay helped me understand why train travel is unpopular even if you can’t beat the price.

I’m having my state of allergies reevaluated so I can’t take any allergy medicine for five days.  I’m not your typical allergy sufferer (if you know me) so I’ve been particularly miserable since Friday.  I hope I never have to do this again.  I’m miserable.

Work is busy but a few weeks of frustration might have a happy ending.  I think that a co worker and I have figured out something that we’ve been struggling with for the last two years.

It’s starting to cool down and the frogs are mostly leaving my back yard.  I dislike fall which means winter is on its way.  Emily is two in January and we’ll be getting a bunk bed soon enough.  Hopefully it’ll be the end of diapers and the beginning of verbal communication.  I want to take these girls camping.

Erin’s at work and I’m watching Gumby with the girls.  It’s fun to see all these cartoons that I haven’t seen since I was a kid.

Long Live The Queen

Aretha Franklin is dead.  My favorite female vocalist, the Queen of Soul, died at 76.  We lost the King of the Blues just over three years ago and now we lose the greatest female voice we know.

This video has 34.6 million views right now.  Let’s see where it is in a few days.  I don’t really want to embed YouTube any longer but for this, I will make an exception.

While listening to an album on my way to work, I felt like this should be included as well.  What a sound.  What a voice.

August 2018

The frogs are back.  I’ve spent the last few months in a nightly battle and species-wide war with the little jerks.  We’ve reached our stride in monsoon season which is good for keeping the frogs out of the back yard.  Monsoons typically hit later in the day which gives the sun less time to evaporate the puddles so the frogs are comfortable enough by the hiking trail and don’t need to jump in my pool.

There are more this year than last year and I think that they’re getting smarter.  A few nights ago I was out looking for a few to scoop into the sky during a lightning storm.  Then I realized that these tiny, pea-brained frogs tricked me into walking around my back yard with a long metal pole in a lightning storm.

I’m not as smart as the frogs I throw into the desert.

There’s a game that just made its way to the Xbox called No Man’s Sky.  It’s been out two years and only now made its way to my ecosystem.  When I heard about it years ago I was already excited to one day buy it.  It’s fantastic and scratches a lot of the exploration itches that I have.  Dinosaurs, geology, space.  I have my complaints but they’re minor relative to what the game offers.  I can’t stop taking photos in the game.

I had to push my car through an intersection a few weeks ago while the temperature was just under 100 at 8:00 AM.  I had the help of a co-worker who gave me a jump and happened to be following me to the mechanic to get things figured out.  I put a new battery in just a few weeks prior and it turns out the alternator took a big dump.

The IMSA series is very exciting this year.  The top three teams are within a few points of each other so each race counts.  IMSA turns 50 next year and is leaving the Disney-identity-crisis FOX network (did Disney buy FOX Sports?) for the better equipped NBC Sports network.  Fortunately I get both through Sling’s basic cheap package and they each have decent apps.

I’m nearly a year into my other game, Project CARS 2.  Check out my photo album.  The randomizer has gotten a bit of use but I think it’s still a bit hidden.  I never meant for it to get “big” or make any money at all so I think that this is all that I can expect.  The game has issues which I’m confident will be addressed in due time.  I feel comfortable exploring space in the other game while I wait for better online racing.

Work has been different.  Better in most ways but very different.

I’m entertaining the idea of removing this blog entirely from the internet.  I’d like to reduce my and my family’s presence which is why I stripped this site down so much.  It’s very easy to adopt the Nihilist viewpoint and say “it doesn’t matter” but I think the passive acceptance of injustice is the worst injustice. I know that’s not a popular opinion.

I’m nearly twice eighteen and Sarah turns a massive four in just a few days.  Grandma will be out to visit and we’ll have a party with a big bouncy castle.

That means that half of my life has passed since I ended one of the worst times of my life…high school.  What a horribly traumatizing few years that was.  I still wish I would have skipped school.

I still get anxious as fall comes around.  Just thinking about going back to a classroom gives me butterflies in my stomach…and it’s been nearly twenty years.