virtual_oss how do you record currently playing audio

Im a bit stumped on how to use virtual_oss to record audio that is currently over a particular dsp device
and was wondering if someone could me a prod in the right direction

i have loaded the cuse module

What id like to do is create a virtual audio device that can be recorded with ffmpeg

Heres the contents of /dev/sndstat

Bash:
pcm0: <Cirrus Logic CS4206 (Internal Analog)> (play/rec)
pcm1: <Cirrus Logic CS4206 (Analog Headphones)> (play)
pcm2: <USB audio> (play) default
pcm3: <USB audio> (play)

The built in speakers are pcm0 and dsp0.1, which i can see can play and record
however my usb dac which is pcm2 and dsp2 can only play

Can i only capture audio from an interface that can both play and record, like dsp0.1 ?

I had a look at the handbooks example for virtual_oss and bluetooth

Bash:
# virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/headphones -d dsp

and also found a bit of code om someones blog

Bash:
# virtual_oss -S -C 2 -c 2 -r 44100 -b 16 -s 1024 -f /dev/dsp2 -d dsp -w dsp.rec.wav -l dsp.rec

the problem is if i use -d dsp with virtual_oss then programs like mpv and mpd then cant the dsp device to play audio through,
i see some people using -d vdsp with virtual_oss, see forum post below

in a nutshell what id like to be able to do is capture the audio that is playing out of the current dsp device and send it to a virtual audio device,
which i could then use with ffmpeg so i can record the desktop audio at the same time as recording the screen

I did come across some bits of code on the forum

I've been on a quest to figure out how to capture audio output for a long time. Apparently OSS doesn't natively support it. Recently I managed to kind of do it using audio/virtual_oss (specifically virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/null -w vdsp -l dsp), but with two inadequacies:

  1. It stops the audio from playing at the same time. Ideally I could use to be able to hear it and record it at the same time.
  2. I can't get OBS to detect the virtual device, so the audio output recording has to be done separately from audio input and video (causing difficulties with synchronization). I know OBS depends on pulseaudio to be able to detect any devices on FreeBSD.
So my question is how to solve these two remaining issues. If I can solve at least one of them, it might be enough to get me to do my video recording on FreeBSD instead of resorting to OBS on a Windows machine.

Put something instead of /dev/null there. -P /dev/dsp1 -R /dev/null, for example.
 
I've arrived here, looking for the exact same answer. :) I would like to use FreeBSD to record my gameplay (with sound). Currently, I can record the gameplay and my mic (for voice-overs) if I want, using ffmpeg, but I cant get it to record the sound of the game.

Have you had any luck in solving your problem?
 
You can record desktop audio and play audio at the same time.

Set /dev/dsp to be a loopback device of whatever is heard through /dev/dsp8 (replace dsp8 with the appropriate device):
Code:
# virtual_oss -S -C 2 -c 2 -r 48000 -b 16 -s 1024 -f /dev/dsp8 -w vdsp.wav -l dsp

Record desktop audio:
Code:
$ dd if=/dev/vdsp.wav of=foo.wav bs=1024

Press CTRL+C to stop recording.
 
Back
Top