Record microphone with FFmpeg in Windows

It’s easy to record your computer microphone with FFmpeg. The only tricky part (although not that tricky) is you just have to know the name of your microphone input.

Before you begin make sure you have FFmpeg added to PATH.

Let’s start by listing your recording devices.

ffmpeg -list_devices true -f dshow -i dummy

Amongst other things this will give you something like:

[dshow @ 0000026723b489c0]  "Line (3- Steinberg UR44)"
[dshow @ 0000026723b489c0]     Alternative name "@device_cm_{33D1A762-90A8-12D0-BD43-00A0C111CE86}\wave_{59B73588-5A74-4E16-A824-48B88GF949B8}"

The only thing you need to note is your device name. In this case it is Line (3- Steinberg UR44).

To start the recording you just run the following code:

ffmpeg -f dshow -i audio="Line (3- Steinberg UR44)" -c:a libmp3lame -ar 44100 -b:a 320k -ac 1 output.mp3

To stop the recording hit CTRL+C.

-f dshow means “DirectShow” and lets FFmpeg capture audio and 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, also known as the MP3 format.

-ar 44100 tels FFmpeg to record at a sample rate of 44,100 Hz. That is the standard for most audio nowadays unless you intend to use the audio for a video in which case you would use 48,000 Hz.

-b:a 320k is the audio bit rate. The highest support for MP3 is 320 kbit/s. -ac 1 means the audio will be in mono as opposed to stereo streams. This makes sense as most microphones record in mono only.

If you haven’t changed the directory in your command line you can always specify where to save the file. For example C:\output.mp3.

Leave a Reply

Your email address will not be published. Required fields are marked *