Record Discord Audio Using ffmpeg and PulseAudio
This article explains how to record audio from a Discord channel on Linux using ffmpeg and PulseAudio. By identifying the correct PulseAudio monitor source corresponding to your system’s audio output, you can capture high-quality Discord conversations directly from the command line and save them into your preferred audio format.
Step 1: Identify Your PulseAudio Monitor Source
To record Discord’s output, you must target the “monitor” of your active audio playback device. PulseAudio automatically creates a monitor source for every output device.
Open your terminal and run the following command to list all available audio sources:
pactl list short sourcesLook for a line that ends with .monitor. For example, if
your default output device is an analog stereo output, you might see a
source named:
alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
If you have trouble finding it, you can filter the list to show only monitor sources:
pactl list short sources | grep monitorCopy the full name of the monitor source you want to record.
Step 2: Record the Audio with ffmpeg
Once you have the monitor source name, you can use ffmpeg to capture
the stream. Use the -f pulse input format and specify the
monitor source with the -i flag.
Run the following command, replacing YOUR_MONITOR_SOURCE
with the name you copied in Step 1:
ffmpeg -f pulse -i YOUR_MONITOR_SOURCE -acodec libmp3lame -ab 192k discord_record.mp3Command Breakdown:
-f pulse: Instructs ffmpeg to use the PulseAudio input device.-i YOUR_MONITOR_SOURCE: Specifies the input source (the monitor of your audio output where Discord is playing).-acodec libmp3lame: Encodes the output audio into MP3 format.-ab 192k: Sets the audio bitrate to 192 kbps.discord_record.mp3: The output file name.
Press Ctrl + C in your terminal to stop the recording when you are finished.
Optional: Record to a Lossless Format
If you plan to edit the recorded audio later, it is recommended to record to a lossless WAV format to preserve original audio quality:
ffmpeg -f pulse -i YOUR_MONITOR_SOURCE discord_record.wav