I have created a virtual alsa loopback device and trying to open a youtube link in google-chrome or chromium-browser and trying to send it's audio output to that virtual device. Then using ffmpeg I am trying to capture the audio. But no matter what I do, chrome or chromium always send audio output to default built-in speakers. If I open volume control panel and change the output of the application in playback section to loopback then it works. But my requirement to be able to do it programatically by telling the chrome to send audio on which device.
Following are the commands which I tried to make it happen:
google-chrome --window-position=0,0 --window-size=1920,1080 --alsa-output-device=alsa_output.1.analog-stereo.monitor -kiosk https://www.youtube.com/watch?v=LTbnmiXWs2k
google-chrome --window-position=0,0 --window-size=1920,1080 --alsa-output-device=hw:1,0 -kiosk https://www.youtube.com/watch?v=LTbnmiXWs2k
And following is the ffmpeg command which is working fine:
ffmpeg -f pulse -i alsa_output.1.analog-stereo.monitor -ac 1 -ar 16000 test.wav
Any help will be appreciated.