Using ffmpeg how to record discord calls?

Particulary 1-on-1. I’m using Plasma.

Never used ffmpeg but I found this reddit post which states:

Use pactl list sources short to get IDs of your devices. Pick out the numbers for your output device.monitor and microphone. You can specify pulse devices as input in ffmpeg using -f pulse -i deviceid.

Then use the amerge filter to merge the two sources together, and output to your filetype of choice.

[juris@juris-aspiree1571 ~]$ pactl list sources short
0       alsa_input.hw_0_0       module-alsa-source.c    s16le 2ch 44100Hz       RUNNING
2       alsa_output.pci-0000_00_1b.0.hdmi-stereo.monitor        module-alsa-card.c      s16le 2ch 44100Hz       RUNNING 

But I don’t know what should I type in step 2.
I would appreciate some guidance.

As far as i understand

aplay -l will give you list of your devices as card 0: , card 1: etc
The number itself should be the device id

[juris@juris-aspiree1571 ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Both items as card 0.
Btw, do I need to type ffmpeg -f pulse -i deviceid twice? One for input (microphone) other time for output (or sound from the person im talking with).

Yeah seems so, you can try just default system capture device btw:

ffmpeg -f pulse -i default "output.wav"

Although for device you can choose subdevice with dot:

-i :0.0

Oh turns out you can also do stuff like that by name from pactl list sources short:

ffmpeg -f pulse -i alsa_input.hw_0_0 "output.wav"
1 Like

Thanks for code examples. :+1:
I will try this later today.

1 Like

I did ffmpeg -f pulse -i default "test2.wav", but where does ffmpeg save output file? Searching google like 15min can’t find the answer. :confused:

Well wherever you’ve started terminal in, i assume it’s your home directory if you haven’t cd anywhere.

btw, you can enter absolute path of where you want output file to go:


It would be more efficient to search your machine for that answer than google. :rofl:

sudo find / -type f -name test2.wav

Yes, silly mistake - was in Home directory. The command works, but I think quality is low, also sound seems lower than from speakers.

@keybreak @dalto I uploaded short test here: Forgive my english, but isn’t sound too low?

Terminal full log
[juris@juris-aspiree1571 ~]$ ffmpeg -f pulse -i default "test1.wav"
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 1627138056.671769, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'test1.wav':
    ISFT            : Lavf58.76.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
      encoder         : Lavc58.134.100 pcm_s16le
size=    7580kB time=00:00:38.58 bitrate=1609.1kbits/s speed=0.989x    
video:0kB audio:7580kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001005%
[juris@juris-aspiree1571 ~]$