Debian – How to record Skype calls (audio) on Debian 6

debianrecordingskype

I conduct business over Skype. Sometimes when I talk to clients they give a lot of instructions real quick. It would be nice to have a way to record conversations so that I could listen to them at a later point of time when I need them.

I have noticed people suggesting 'recordmydesktop', 'xvidcap', and 'ffmpeg' for recording. However, I DO NOT want to record video. I just want to record voice calls while having my headphones on. This means that I should be able to record the sound inline, not record it externally by pulling out my headphones and putting my clients on speaker (I know they can hear that, and they don't like it).

If there are ways you know that can solve my problem on a Debian 6 system, please let me know.

Best Answer

Via ALSA emulation

I don't have a Debian 6.0.x box to test on, but I think this way will probably work. Courtesy an example on the Arch wiki.

First, use pacmd list-sources to find the name of your sound card's monitor stream. Grep for .monitor works pretty well:

$ pacmd list-sources | grep '\.monitor'
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
        name: <alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor>

I have two cards, hence two monitors. Then edit your ~/.asoundrc to set up an ALSA device for it, by adding lines like (but of course use your monitor device name, not mine):

pcm.pulse_monitor {
    type pulse
    device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor
}

ctl.pulse_monitor {
    type pulse
    device alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor
}

Then use arecord -f s16_le -t wav -r 44100 -D pulse_monitor /tmp/outfile.wav to record.

Older PulseAudio Utilities

Instead of using ALSA emulation, you can use parecord on the monitor you found above. Do so like this: parecord -d alsa_output.usb-stereo-link_stereo-link_1200_USB_DAC-00-DAC.analog-stereo.monitor outfile.wav. That should work with parec as well (in the LAME example below)

Newer PulseAudio Utilities

PulseAudio ships with a parecord command-line utility that can record sound going through it.

To use it, first find the index of the stream you want to capture. Easy way from the command line is pacmd list-sink-inputs, which should give something like this:

1 sink input(s) available.
    index: 10720
        driver: <protocol-native.c>
        ⋮
        client: 87 <Chromium>
        ⋮

I've omitted a bunch of lines; but you can see that's Chromium (where I have a music player running). The index: 10720 bit is important.

To record it, it's as simple as parecord --monitor-stream 10720 outfile.wav. You can also write the output to stdout and use it as part of a pipe with parec; for example if you're short on disk space you could directly encode to MP3:

parec --monitor-stream 10720 --format s16le --channels 2 --rate 44100 \
    | lame -r -s 44.1 -b 16 --signed --little-endian --preset medium /dev/stdin outfile.mp3
Related Question