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

Leave a comment

Leave a Reply