Below is the Recording menu from pavucontrol. Note here there are 3 “applications” recording audio.
Look at that image above. The 3rd application (the lowest shown in the image) is “ffmpeg” (listed as an ALSA plug-in). In this example, I was using ffmpeg to record my desktop with the command:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1920x1200 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.avi
Note in that ffmpeg command I have “pulse” selected instead of a hardware device such as “hw:0,0” or something else. This means ffmpeg uses pulse for its sound recording. And note (in the recording menu) that the pulse capture from ffmpeg is also being received from the “monitor of null output”.
Note the two loopback ‘applications’ (I say ‘application’ for lack of a better word – they are NOT really apps). I have one “loopback” set to “Internal Audio Analog Stereo” which is the front microphone on my computer. I have the other “loopback” set to “Monitor of Internal Audio Analog Surround-5.1”. This corresponds to any audio being handled by my motherboard’s sound system (in this case it is a youtube video being played in firefox !! - that will be clear on the ‘playback’ menu).
Note these “loopbacks” were created by sending twice the following command:
pactl load-module module-loopback sink=something
Note I had to use the same ‘name’ for the sink (ie ‘something’) which I previously arbitrarily picked. I created 2 loopbacks, so that I had one loopback for my front microphone and one for my sound card on my PC. If I had wanted to include my webcam mic (so to mix its recorded audio also), I would have had to add a 3rd loopback and hence would have had to send that command a third time.
Below is the “Playback” menu from pavucontrol.
At the top is System Sounds. I don’t have anything to say here. Just ignore this for this example.
Next is “loopback of the Internal Audio Analog Stero” which is my Front Microphone. It is playing audio from the mic to the “null output” (and NOT to the speakers).
Next is “loopback” of the Interal Audio Analog Surround 5.1 which is all audio going through my motherboard. It is playing audio from the motherboard to the “null output” (and NOT to the speakers).
Next is ALSA plug-in (firefox) which is the application firefox that I have playing a youtube video !! It is playing audio from this application and sending it to the “Internal Audio Analog Surround 5.1” which means I can hear the audio from Firefox.
So, what does all that mean ?
I think it means any audio recorded by my Front Mic (with me talking), or any going through my motherboard audio is sent to the ‘null device’ audio sink. That includes any audio from firefox which is playing a youtube video. The recording is ALSO being done by ffmpeg, which is receiving the audio from pulse which in turn is receiving the audio from the “audio sink” null-device. With both microphone and firefox youtube going to the null, this ensures both youtube audio and microphone audio is recorded into the ffmpeg output.avi file.
Also then any audio from Firefox is also sent to my speakers, such that I can hear Firefox playing the youtube video, while I am recording.
Hence when I playback output.avi, I hear both myself talking in the mic, and youtube video.
So why do this ?
Because if one replaces “firefox” with “skype” I can record the video chat/conversation of a family member/loved one. That’s very nice to have such a recording for an expatriate far from home.
There is also a basic ‘principle’ for some of us, where ANY audio that goes through our computer we want to be able to record. In this case I’m recording BOTH any video and any audio that goes through my computer. And the audio recording side is helped thanks to pulse audio.
If the above reads to be confusing, its because its still possibly a bit fuzzy in my mind, and I don’t have a firm enough grip on this to explain in more simple English.