How to record microphone audio
with ffmpeg (MacOS)

Tomasz Marciniak

Sometimes you need to record audio from mic input. You could use built-in QuickTime Player, but what if you want to do it from shell? It’s very easy, the only caveat is that you need 3rd party tool: ffmpeg. It’s available from Homebrew.

First, identify the microphone. Run the following command:

ffmpeg -f avfoundation -list_devices true -i ""

The output is quite elaborate but you’ll notice something like:

[AVFoundation indev @ 0x140605990] AVFoundation audio devices: [AVFoundation indev @ 0x140605990] [0] USB PnP Audio Device [AVFoundation indev @ 0x140605990] [1] External microphone

Choose the index number (in square brackets) of the device you want to use. In my case it’s “1”. Then:

ffmpeg -f avfoundation -i ":1" input.wav

Press ^C when you’re done recording.