Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2025 18:59:12 +0300
From:      Artem Bunichev <tembun@bk.ru>
To:        Carl Johnson <carlj@peak.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to record audio from multiple mixer(8) devices simultaneously
Message-ID:  <20250426185912.5da275286d0574816f9807f2@bk.ru>
In-Reply-To: <86h62a2acv.fsf@bay.localnet>
References:  <20250426000125.db4e9ac0ac4ed2c2ae6fdb1e@bk.ru> <86h62a2acv.fsf@bay.localnet>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 26 Apr 2025 08:47:28 -0700
Carl Johnson <carlj@peak.org> wrote:

> 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
>

Thank you for the answer, Carl!  I will check it out.

However, I'm quite interested in making this without third-party packages,
using only base system (I like to understand how things work internally).
Do I understand correctly, that current implementation of /dev/dsp in FreeBSD
14-STABLE does not allow to do what I want?  Does this patch seems to allow this
when applied: https://reviews.freebsd.org/D49216?

Artem.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20250426185912.5da275286d0574816f9807f2>