Record audio with FFmpeg

It’s easy to record your computer microphone with ffmpeg. You just have to know the name of your microphone input.

ffmpeg -list_devices true -f dshow -i dummy

To start the recording you just run:

ffmpeg -f dshow -i audio="name_of_your_microphone" -c:a libmp3lame -ar 44100 -b:a 320k -ac 1 output.mp3

-f dshow means “DirectShow” and lets ffmpeg capture from audio, video devices, video capture devices, analog tv tuner devices.

-i audio="name_of_your_microphone" is the audio device you wish to record from. Replace `name_of_your_microphone``with the name of your input device.

-c:a libmp3lame means ffmpeg will encode the audio with LAME (MPEG Audio Layer III) a.k.a MP3 format.

-ar 44100 will enable audio sample rate at 44,100 Hz. The standard for audio CDs.

-b:a 320k is the audio bit rate. The highest supported for MP3 is 320 kbit/s. -ac 1 means the audio will be in mono as opposed to two stereo streams.