Capturing a USB microphone is a one-line command on Linux (ALSA), macOS (AVFoundation), or Windows (DirectShow). The output is a raw audio file you can use for a podcast, a voiceover, or a live stream.

The command

ffmpeg -f alsa -ac 2 -ar 48000 -i hw:0,0 -c:a pcm_s16le out.wav

What it does

The command opens the first ALSA device (`hw:0,0`) at 48 kHz stereo, captures the audio, and writes it to a 16-bit PCM WAV file. The `hw:0,0` syntax is `card:device`; use `arecord -l` to list the available cards and devices. For macOS, the command is `ffmpeg -f avfoundation -i ":0" -c:a pcm_s16le out.wav` (the first `0` is the audio device index).

Requirements

A USB microphone that the OS recognizes. The platform-specific input format (`alsa`, `avfoundation`, `dshow`). The output codec `pcm_s16le` is the standard 16-bit signed little-endian PCM, which is what every audio editor and player reads. No hardware acceleration needed.

Things to avoid

  • Using a device name that does not exist. On Linux, run `arecord -l` to see the available devices; on macOS, run `ffmpeg -f avfoundation -list_devices true -i ""`.
  • Capturing at a sample rate the microphone does not support. A 192 kHz USB mic may not produce a 192 kHz signal; check the datasheet for the supported rates.
  • Re-encoding the audio multiple times. The output is already PCM, so leave the codec as `pcm_s16le` for the cleanest file.
  • Forgetting the `-ac 2` flag. The default is mono, which may not match the microphone's stereo output, and the result will be a silent right channel.