Recently I was in a position whereby I wanted to record some audio coming from my ArchLinux system. I’d looked into this a long time ago and remember having to setup complicated PulseAudio sinks and separate outputs to achieve a simple recording. I was pleasantly surprised at just how easy it was now using ffmpeg, the Swiss army knife of multimedia manipulation.
First you have to identify which source (audio output) you would like to record from. There can be many sources on your machine, you can list them with the following command:
In my case I only have the one:
You will need to take note of the name of the source. For example:
Once you are ready to record simply run the following ffmpeg command:
Hit q to stop recording when the audio has finished playback. Simple.
Bonus - Extracting part of an MP3 with ffmpeg
If you were too slow to stop the recording and would like to extract a smaller part of your MP3, simply find the start time (00:12 for example) and end time (29:23 for example) and run the following command:
You can see what else ffmpeg is capable of by heading over to their documentation online https://ffmpeg.org/ffmpeg.html.