Capturing audio with ffmpeg and pulseaudio is pretty much straightforward:

ffmpeg -f pulse <input_options> -i <input_device> ... output.wav

See the FFmpeg pulseaudio input device documentation for more info.

Selecting the input

input_device tells ffmpeg which pulseaudio source you would like to use. To get the list of all pulseaudio available sources, you can type pactl list short sources.

$ pactl list short sources
5       alsa_input.pci-0000_00_1b.0.analog-stereo       module-alsa-card.c      s16le ch 2 44100 Hz     RUNNING
6       alsa_output.pci-0000_00_1b.0.analog-stereo.monitor      module-alsa-card.c      s16le ch 2 44100 Hz     RUNNING

We can see there are 2 sources available: number "5" (an alsa-supported soundcard input device, e.g. a microphone) and number "6" (a virtual .monitor device created by pulseaudio, so that you can record the current soundcard output). If you want more detail for each source, run pactl list sources.

You can reference sources either by number: -f pulse -i 5, or by name -f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo, or just use -f pulse -i default to use the source currently set as default in pulseaudio.

You can select the default pulseaudio source running pactl set-default-source SOURCE-NAME, or using the pavucontrol GUI (see below).

Mixer tools

You can select the source device and the recording level, with different tools.


The easiest way is to use the pavucontrol GUI: go to the Input Devices tab, filter the list of source devices using the Show menu, select a device (and possibly its Port, for example to choose between a built-in microphone or a pluggable one), make sure the device in unmuted, set the recording volume level, using the VU meter. You can set this device as the default source by checking the Set as fallback icon.


If you prefer CLIs, or want to automate things, you can achieve the same results issuing pactl commands; for example:

pactl set-source-port alsa_input.pci-0000_00_1b.0.analog-stereo analog-input-internal-mic
pactl set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo 0
pactl set-source-volume alsa_input.pci-0000_00_1b.0.analog-stereo 60%

will select the internal microphone as source, unmute it (this is the equivalent of turning on the "Capture" feature in ALSA parlance), and set a recording volume level of 60%.

Input options

pulseaudio supports common options like -sample_rate (audio sample rate) and -channels (audio channels), and special options like -server, to record from remote hosts running the pulseaudio server. All options are documented at


Once you set your source, recording volume and possibly other options, you can issue the complete ffpmpeg command to record sound from a pulseaudio source.

Record audio from your microphone

ffmpeg -f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo -ac 1 recording.m4a

Record audio from an application

ffmpeg -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -ac 2 recording.m4a

Actually this will record audio from all the applications currently playing sounds; to select a single application, you can use pavucontrol, go to the Playback tab, and mute all the applications you don't want to record.

Last modified 3 months ago Last modified on Nov 27, 2020, 9:51:35 PM