Re: How to record audio from multiple mixer(8) devices simultaneously

From: Carl Johnson <carlj_at_peak.org>
Date: Sat, 26 Apr 2025 15:47:28 UTC
Artem Bunichev <tembun@bk.ru> writes:

> Hi!
>
> I'm running FreeBSD 14-STABLE on ThinkPad X220 and I want to record sound from
> the integrated microphone and the system sound (sound from applications) at the
> same time.  So far, I've figured how to record only one of them at a time: I
> can do this by means of setting the recording device in mixer(8).  If I want
> to record from microphone, I do: mixer monitor.recsrc=set, and if I want to
> record the desktop sound, I do: mixer mic.recsrc=set.  As I understand,
> recording device sets the device, which output I will get when I read
> from /dev/dsp.
>
> Actually, I want to record an audio for screencast, which I do with:
> ffmpeg -f x11grab -i :0 -f oss -i /dev/dsp -vcodec libx264 -preset fast out.mkv.
>
> So, I guess I need to find a way to make both sound from microphone and system
> sound go into /dev/dsp.  But I don't know how to do this, since as I can see in
> mixer(8), only _one_ device can be used for recording.
>
> Here's the output of /dev/sndstat:
> Installed devices:
> pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
> pcm1: <Intel Cougar Point (HDMI/DP 8ch)> (play)
> pcm2: <Intel Cougar Point (HDMI/DP 8ch)> (play)
> pcm3: <Intel Cougar Point (HDMI/DP 8ch)> (play)
> No devices installed from userspace.
>
> The output of mixer:
> pcm0:mixer: <Conexant CX20590 (Analog 2.0+HP/2.0)> on hdaa0 (play/rec) (default)
>     vol       = 1.00:1.00     pbk
>     pcm       = 1.00:1.00     pbk
>     speaker   = 1.00:1.00     pbk
>     mic       = 1.00:1.00     rec
>     rec       = 1.00:1.00     pbk
>     monitor   = 0.37:0.37     rec src
>
> Is the thing I want to do is even possible?  If yes, how can I do that?

I don't know if you have an answer yet, but the virtual_oss port (or
package) looks like it would probably allow you to do what you want.

Hope that helps.
-- 
Carl Johnson		carlj@peak.org