0

List sound card info on my pc.

pacmd list-sources |grep name:
    name: <alsa_input.usb-SN0002-02.analog-mono>
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
    name: <alsa_input.pci-0000_00_1b.0.analog-stereo>

Set variables to simply next command:

speaker=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
mic=alsa_input.usb-SN0002-02.analog-mono

Record a music playing on the speaker:

ffmpeg -use_wallclock_as_timestamps 1 -f pulse -i $speaker -acodec copy  /tmp/out.mkv

Record voice speaking to the mic:

ffmpeg -use_wallclock_as_timestamps 1 -f pulse -i $mic -acodec copy  /tmp/out.mkv

Now to record the sound both in the speaker and mic:

ffmpeg -use_wallclock_as_timestamps 1 \
    -f pulse -i $speaker -f pulse -i $mic \
    -acodec copy  /tmp/out.mkv

It output info on the screen:

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor':
  Duration: N/A, start: 1606130053.472713, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, pulse, from 'alsa_input.usb-SN0002.analog-mono':
  Duration: N/A, start: 1606130053.597432, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s

It record no voice speaking to the mic recorded in /tmp/out.mkv ,only sound playing on speaker recorded?Why ffmpeg guess the Channel Layout for Input Stream?

I have tried the method on superuser:

https://superuser.com/questions/899352/ffmpeg-commandline-options-to-recording-audio-from-mic-and-speakers

ffmpeg -use_wallclock_as_timestamps 1 \
    -f pulse -i $speaker -f pulse -i $mic   \
    -acodec libmp3lame -map 0:0 -map 1:0   /tmp/out.mkv

It record nothing ,both sound on the speaker and mic can't be recorded.

showkey
  • 342

1 Answers1

0

Usually it's not possible to record audio from two sources at once. You have first to use this solution to route audio from your microphone into the speakers and then record the mix of what you hear in the speakers.

raj
  • 10,353