I never could get snd_aloop
to work on my systems. Furthermore using ffmpeg -f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor etc.
caused there to be a 1-2 second lag in the system audio recording. The answer by mxc helped me to find my solution, but I wanted to add a little bit of information.
I first needed to set my Pulse Monitor of Built-in Audio to default. Then I ran the commands listed above. I wanted this to be the default on my profile every time so I created ~/.config/pulse/default.pa
and added the following lines:
.include /etc/pulse/default.pa
set-default-source alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
load-module module-null-sink sink_name=MySink
update-sink-proplist MySink device.description=MySink
load-module module-loopback sink=MySink
The first line includes the system-wide PulseAudio settings. Then the last four lines are prioritized for the user over any system settings. Of course any of the last four lines can be run in the terminal when preceded by pacmd
.
To get the name of your Pulse Monitor of Built-in Audio device run:
pacmd list-sources | awk '/index:/ {print $0}; /name:/ {print $0}; /device\.description/ {print $0}'