How to capture desktop sounds (Pulse Audio output) from avconv?

Solution 1:

The syntax to invoke avconv is nicely explained in the manpage for avconv. From audio recordings the following options are available:

-f: Force input or output file format.
-i: input file name

To record from ALSA we need the format to be alsa, and the input depends on the device we record (usually this will be the defualt device). Then your command should be as follows:

avconv -f alsa -i default record.wav

To simply record from an ALSA device we may consider using the more basic command line tool arecord. This gives the following example command for a 10 second (-d) recording in cd quality (-f) in wav codec (-t):

arecord -d 10 -f cd -t wav -D copy record.wav

To be able to record from an output sink, we may have to choose a duplex audio profile in "Sound Settings --> Hardware":

enter image description here

Unfortunately In >= 13.04 the hardware configuration was removed from the sound settings. To have access to advanced device configurations we need to install and run pavucontrol Install pavucontrol. The duplex profile can then be selected in the Configuration tab:

enter image description here