Record PulseAudio Audio with FFmpeg on Linux

Recording system audio or microphone input on Linux is a common task that can be easily accomplished using FFmpeg and PulseAudio. This guide provides a straightforward, step-by-step tutorial on how to identify your PulseAudio input devices and capture high-quality audio directly to a file using simple FFmpeg commands.

Step 1: Find Your PulseAudio Source Name

Before recording, you need to identify the name of the audio source you want to capture. PulseAudio distinguishes between physical inputs (like microphones) and “monitors” (which capture the audio playing out of your speakers).

Run the following command in your terminal to list all available sources:

pactl list sources short

This will output a list of sources. Look for the name of the device you want to record.

Step 2: Record Audio Using FFmpeg

Once you have the source name, you can use FFmpeg to capture the audio.

Record from the Default Audio Device

If you simply want to record from your default PulseAudio input device, run:

ffmpeg -f pulse -i default output.mp3

Record from a Specific PulseAudio Source

To record from a specific device identified in Step 1, pass the exact source name to the -i parameter.

For example, to record system playback (desktop audio):

ffmpeg -f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor output.wav

Command Breakdown

To stop the recording at any time, press q or Ctrl+C in your terminal window.