Created
May 24, 2023 00:52
-
-
Save PSingletary/c323fdb4321f62f008b73f2ffc71557b to your computer and use it in GitHub Desktop.
use vlc to trancode wav to mp3
This file contains hidden or 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
<# | |
.link | |
https://wiki.videolan.org/VLC_HowTo/Transcode_multiple_videos/ | |
#> | |
$outputExtension = ".mp3" | |
$bitrate = 160 | |
$channels = 2 | |
foreach($inputFile in get-childitem -recurse -Filter *.wav) | |
{ | |
$outputFileName = [System.IO.Path]::GetFileNameWithoutExtension($inputFile.FullName) + $outputExtension; | |
$outputFileName = [System.IO.Path]::Combine($inputFile.DirectoryName, $outputFileName); | |
$programFiles = ${env:ProgramFiles(x86)}; | |
if($programFiles -eq $null) { $programFiles = $env:ProgramFiles; } | |
$processName = $programFiles + "\VideoLAN\VLC\vlc.exe" | |
$processArgs = "-I dummy -vvv `"$($inputFile.FullName)`" --sout=#transcode{acodec=`"mp3`",ab=`"$bitrate`",`"channels=$channels`"}:standard{access=`"file`",mux=`"wav`",dst=`"$outputFileName`"} vlc://quit" | |
start-process $processName $processArgs -wait | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment