Created
December 28, 2016 15:08
-
-
Save glitchedmob/54eb8617d1bd835a76b0b81c4667a7c1 to your computer and use it in GitHub Desktop.
A powershell script that uses VLC's audio codecs to convert multiple file in different audio formats to .mp3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertToMp3([switch] $inputObject, [string] $vlc = 'C:\Program Files\VideoLAN\VLC\vlc.exe') { | |
process { | |
Write-Host $_ | |
$codec = 'mp3' | |
$newFile = $_.FullName.Replace("'", "\'").Replace($_.Extension, ".$codec") | |
&"$vlc" -I dummy "$_" ":sout=#transcode{acodec=$codec,vcodec=dummy}:standard{access=file,mux=raw,dst=`'$newFile`'}" vlc://quit | out-null | |
# Uncomment the next line when you're sure everything is working right | |
#Remove-Item $_.FullName.Replace('[', '`[').Replace(']', '`]') | |
} | |
} | |
function ConvertAllToMp3([string] $sourcePath) { | |
Get-ChildItem "$sourcePath\*" -recurse -include *.wma,*.aac,*.ogg,*.m4a | ConvertToMp3 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment