TIL: Converting Audio Formats With ffmpeg in One Command
Every audio API has different format requirements. ffmpeg converts between them without opening a GUI.
ffmpeg -i input.wav -ar 16000 -ac 1 output.mp3
-i specifies the input. -ar sets the sample rate (16000 Hz is common for speech). -ac sets the number of channels (1 for mono, 2 for stereo).
ffmpeg -i input.mp3 -c:a flac output.flac
Transcode between lossy and lossless formats. -c:a selects the audio codec. FFmpeg probes input files and picks sensible defaults for options you omit.
ffmpeg -i input.wav -af 'silenceremove=start_periods=1:start_duration=1:start_threshold=-50dB' cleaned.wav
Remove silence from the start of a recording using the silenceremove audio filter. Beats opening Audacity.
Is ffmpeg available on macOS?
brew install ffmpeg
What format should I use for STT?
Linear PCM in a WAV container, 16-bit, 16kHz mono. That is what most speech-to-text APIs prefer for lowest latency.