Capture Microphone Audio on macOS Using FFmpeg
This article provides a quick, step-by-step guide on how to record audio from your default microphone on macOS using the FFmpeg command-line tool. You will learn how to identify your system’s audio input devices and execute the precise command needed to capture and save your microphone audio to a file.
Step 1: Install FFmpeg
Before starting, ensure you have FFmpeg installed on your Mac. The easiest way to install it is via Homebrew by running the following command in your Terminal:
brew install ffmpegStep 2: List Available Audio Devices
macOS uses the avfoundation framework to handle audio
and video input. To find your default microphone, run the following
command to list all available devices:
ffmpeg -f avfoundation -list_devices true -i ""In the Terminal output, look for the section labeled “AVFoundation
audio devices”. You will see your microphone listed alongside an index
number (for example, [0] Built-in Microphone).
Step 3: Record Audio from the Default Microphone
To capture audio directly from your system’s default microphone, you
can use the :default device identifier. Run this command to
start recording and save the audio as a WAV file:
ffmpeg -f avfoundation -i ":default" output.wavIf you prefer to target a specific microphone using the index number
found in Step 2 (for example, index 0), format the command
like this:
ffmpeg -f avfoundation -i ":0" output.wavYou can also change the file extension to .mp3 or
.m4a if you prefer a compressed audio format.
Step 4: Stop the Recording
To stop recording at any time, press q or
Ctrl + C in your Terminal window. FFmpeg will safely stop
the capture process and save your audio file to the current
directory.