PoshCode Logo PowerShell Code Repository

Convert-ToMP3 by CrazyDave 26 months ago
View followups from CrazyDave | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1501"></script>download | new post

This script uses VLC to convert an audio file to MP3 format. It makes the assumption that you have an Alias “vlc” that points to the VLC executable.

  1. param([String] $inputPath, [String] $wildcard, [String] $outputPath = $inputPath
  2.  
  3. gci -path $inputPath\$wildcard | % {  
  4.   $outputFile = Join-Path $outputPath ($_.Name.Replace($_.Extension, '.mp3'))  
  5.   vlc -I dummy $_.FullName ":sout=#transcode{acodec=mp3,ab=128,channels=6}:standard{access=file,mux=asf,dst=$outputFile}" vlc://quit
  6.   Get-Process vlc | % { $_.WaitForExit() }
  7. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me