Important
Basic terminal and PBX management skills are assumed.
Extensible apps for asterisk: Talk Bot • Music Player
This script will convert common AV files (mp3, wav, flac, webm, mkv, mp4) to Mono 8kHz PCM WAV files suitable for Asterisk. Converted files will be placed in a subdirectory named processed.
- Ensure FFmpeg is installed on your system.
- Open your terminal, then navigate to the directory containing the audio files to be converted.
- Copy and paste the script into your PowerShell terminal.
The text being red is not of concern.
$OPATH = 'processed'
$TYPES = 'mp3', 'wav', 'flac', 'webm', 'mkv', 'mp4'
New-Item $OPATH -Type Directory -Force
$TYPES `
| ForEach-Object { Get-ChildItem "*.$_" } `
| ForEach-Object -Parallel {
$OFILE = Join-Path $using:OPATH ($_.BaseName + '.wav')
& ffmpeg -i $_.Name -ar 8000 -ac 1 -acodec pcm_s16le $OFILE # -map_metadata -1
} -ThrottleLimit 4