Here is a PowerShell script for converting music for upload into Cisco Unified Communications Manager (CallManager). Of course this can be used for other call processing systems, though the ideal codec/bitrate may vary. CUCM does some internal conversion of the file, but many people experience pops/crackles and poor quality overall. This may be due to trying to upload a file that is too high of quality.
Be sure to have ffmpeg.exe in the same directory!!!!!!!
DISCLAIMER: I have no idea what I’m doing.
#--- VARIABLES $outputPath = "$($env:USERPROFILE)\Desktop\CUCM_MOH_Output\" #--- CREATE DIRECTORIES if(!(Test-Path -Path $outputPath )){ New-Item -Force -ItemType directory -Path $outputPath } #--- MAIN MENU do { Clear-Host write-host "##############################################################################" -ForegroundColor Green write-host "# #" -ForegroundColor Green write-host "# Mr. Bray's CUCM MOH Converter v1 #" -ForegroundColor Green write-host "# #" -ForegroundColor Green write-host "# Don't use anything other than defaults [in brackets], #" -ForegroundColor Green write-host "# unless you know what you're doing! #" -ForegroundColor Green write-host "# #" -ForegroundColor Green write-host "##############################################################################" -ForegroundColor Green write-host "" $channels = Read-Host -Prompt ' Number of channels [1] ' if($channels -eq $null){ $channels = "1" } if($channels -eq ""){ $channels = "1" } write-host "" $bitrate = Read-Host -Prompt ' Bitrate (128k,64k,32k) [64k] ' if($bitrate -eq $null){ $bitrate = "64k" } if($bitrate -eq ""){ $bitrate = "64k" } write-host "" $codec = Read-Host -Prompt ' Codec (pcm_mulaw,pcm_s16le,etc.) [pcm_s16le] ' if($codec -eq $null){ $codec = "pcm_s16le" } if($codec -eq ""){ $codec = "pcm_s16le" } write-host "" $sampleRate = Read-Host -Prompt ' Sample rate (48000,32000,16000,8000) [8000] ' if($sampleRate -eq $null){ $sampleRate = "8000" } if($sampleRate -eq ""){ $sampleRate = "8000" } write-host "" $volume = Read-Host -Prompt ' Volume [1] ' if($volume -eq $null){ $volume = "1" } if($volume -eq ""){ $volume = "1" } write-host "" $tempo = Read-Host -Prompt ' Tempo [1] ' if($tempo -eq $null){ $tempo = "1" } if($tempo -eq ""){ $tempo = "1" } write-host "" $inputFile = Read-Host -Prompt ' Input file location (drag to this window) ' if($inputFile -eq $null){ $inputFile = "moh.mp3" } if($inputFile -eq ""){ $inputFile = "moh.mp3" } write-host "" $outputFile = Read-Host -Prompt ' Output file description ' if($outputFile -eq $null){ $outputFile = "output" } if($outputFile -eq ""){ $outputFile = "output" } $command = ".\ffmpeg.exe -i `"$inputFile`" -ac $channels -ab $bitrate -acodec $codec -ar $sampleRate -af `"volume=$volume,atempo=$tempo`" `"$outputPath$outputFile-$bitrate-$codec-$sampleRate.wav`"" Write-Host "Command to run: " Write-Host "$command" pause .\ffmpeg.exe -i "$inputFile" -ac $channels -ab $bitrate -acodec $codec -ar $sampleRate -af "volume=$volume,atempo=$tempo" "$outputPath$outputFile-$bitrate-$codec-$sampleRate.wav" explorer.exe $outputPath write-host "" $runagain = Read-Host -Prompt ' Run again? (y/n) [n] ' if($runagain -eq $null){ $runagain = "n" } if($runagain -eq ""){ $runagain = "n" } } until ( $runagain -match "n" )