Record Audio Using FFMpeg With PulseAudio On Linux

21 February, 2023

On Linux with PulseAudio installed.

List all devices

To list all of our devices we can run this command:

pactl list sources

Record an audio device

We will be using the Source #Number from the command above here. Replace the placeholder (<Source Number>) in the command below with it.

Recording one input:

ffmpeg -f pulse -i <Source Number> pulse.wav

Recording multiple inputs:

ffmpeg -f pulse -i <Source Number> -f pulse -i <Source Number> -map 0 -map 1 pulse.mp4

Note: To record desktop audio all you have to do is get the source id of the headphones/speakers the audio is playing to.

Windows?

If you are on Windows, the command below should work for you or hopefully atleast get you in the right direction.

ffmpeg -f dshow -i audio="full audio device name" out.mp3

DirectShow Wiki For More Info: https://trac.ffmpeg.org/wiki/DirectShow