Pulseaudio Virtual Source – Redirecting Pulseaudio Sink to a Virtual Source

audiopulseaudio

I'm trying to redirect the sound of a program (in my case, ffmpeg) to a source, so I can play the sound in question in Zoom (video conference software). The classic way of doing this would be to select, as a sound source in Zoom, the SinkName.monitor source, since every sink comes with a monitor. But :

1) Zoom doesn't list the monitor sources in its microphone dropdown. I've tried setting the monitor's device.class property to "sound" (instead of "monitor") to trick Zoom into accepting it, to no avail.

2) Zoom seems to refuse to let you set the source yourself from pavucontrol. In the Recording tab, when I try to set myself another source to be listened to by Zoom, no matter what I choose, my choice is ignored. The dropdown option doesn't even change. I've read somewhere that creating ~/.alsoftrc and writing "[pulse]" (new line) "allow-moves=yes" could help, but it didn't do anything for me.

Therefore, I'm trying to set my own source, and "redirect sound to it". I created a null sink, a null source, and a loopback, but upon opening pavucontrol, I understood that I probably got it backwards; a loopback appears to be used to redirect a source to a sink, not the other way round (pavucontrol says, under Playing: "Loopback of MySource on […] MySink", MySink being the value of the dropdown list on the right).

Is there a way to achieve what I'm trying to do? Either:

a) Modify a monitor so as to make it look like a normal microphone, or

b) Redirect the sound of a sink to a source ?

Thanks.

Best Answer

Found another way to do it: module-pipe-source.

pactl load-module module-pipe-source source_name=virtualmic file=/tmp/virtualmic format=s16le rate=44100 channels=1

Then:

ffmpeg -re -i movie.mkv -f v4l2 /dev/video2 -f s16le -ar 44100 -ac 1 - > /tmp/virtualmic

(Note that this also fakes a webcam, using the module v412loopback)

Related Question