How to make each application have its own audio monitor in pulseaudio?

I want to record two live video streams (rtmp flash videos in a browser) at the same time and I'm running two instances of the SimpleScreenRecorder for that. Each instance records a different region on the screen. The only problem is sound. I use separate browsers so each browser has its own audio playback in pulseaudio.

enter image description here

How can I separate playbacks so that each playback stream will have a separate pulseaudio monitor? I have only "Monitor of Built-In Audio Analog Stereo", but I need two monitors, one for Firefox and one for Chrome.

enter image description here


Solution 1:

I have done it using Jack audio server :

  • Install jackd and qjackctl : say "yes" when asked to have real time access right, then reboot to apply this access right.
  • Stop temporarily pulseaudio with this 3 commands :
    mkdir ~/.pulse
    echo autospawn=no > ~/.pulse/client.conf
    pulseaudio -k

(Later, to revert to pulseaudio normal mode, run echo autospawn=yes > ~/.pulse/client.conf then pulseaudio )

  • create .asoundrc (the point is important) in your home dir containing :

pcm.!default { type plug slave { pcm "jack" } }

pcm.jack { type jack
playback_ports { 0 system:playback_1 1 system:playback_2 }
capture_ports { 0 alsa_pcm:capture_1 1 alsa_pcm:capture_2 } }

ctl.mixer0 { type hw card 1 }

  • Run qjackctl from sound menu, click "start", click "connect" to display "connections" windows.

  • Launch 2 differents SimpleScreenRecorder , chose "jack" as audio , start preview mode to display vumeter in both

  • Launch Firefox and Chrome, play video in each
  • Go to qjackctl "connections" windows , drag and drop from the first left side "jack-alsa-xxx" to the first right side "simplescreenrecorder": you will get a connection displayed and vumeter will move in the first simplescreenrecorder. Do the same for the second "jack-alsa" and "simplescreenrecorder"
  • Now you can record audio from each browser in each simplescreenrecorder

May be Firefox has problem with html5 and jack audio server in youtube, I have only tested with flashplayer. qjackctl