I have never used avconv before. I've been reading the manual and asking questions on various forums and IRC for the last couple weeks but I have not found an answer yet. (This question is one part of a larger question I asked here. I am breaking it down because this key part is where I need help first. I may delete the other question because it may be too broad or ill-defined.)

I used pacmd list-cards to list my streaming audio sources. Below are the two that I need to define as inputs to avconv.

  1. alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo
  2. alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo

So my question is simply, How do I define those sources as inputs to avconv?

More info/background follows:

Once I know how to define the audio inputs I plan to use them similarly to this:

OUTPUT="audio_`date +%Y-%m-%d_%H%M`"
avconv \
-f alsa -ac 2 -i <alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor> \
-f alsa -ac 1 -i <alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo> \
-map 0:0 -map 1:0 \
-acodec flac \
-threads 0 \

I assume I need to replace what is in angle brackets with the correct notation. And I have no idea if the rest of the above script is even close...

Here's my hardware info:

$ pacmd list-cards  
Welcome to PulseAudio! Use "help" for usage information.  
>>> 3 card(s) available.  
[snip other cards]
index: 2
name: <alsa_card.usb-Focusrite_Scarlett_2i2_USB-00-USB>
driver: <module-alsa-card.c>
owner module: 6
        alsa.card = "1"
        alsa.card_name = "Scarlett 2i2 USB"
        alsa.long_card_name = "Focusrite Scarlett 2i2 USB at usb-0000:04:00.0-2, high speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:04:00.0-usb-0:2:1.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1c.4/0000:04:00.0/usb3/3-2/3-2:1.0/sound/card1"
        udev.id = "usb-Focusrite_Scarlett_2i2_USB-00-USB"
        device.bus = "usb"
        device.vendor.id = "1235"
        device.vendor.name = "Novation EMS"
        device.product.id = "8006"
        device.product.name = "Scarlett 2i2 USB"
        device.serial = "Focusrite_Scarlett_2i2_USB"
        device.string = "1"
        device.description = "Scarlett 2i2 USB"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
        output:analog-stereo: Analog Stereo Output (priority 6000)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060)
        output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (priority 6055)
        output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500)
        output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 5560)
        output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (priority 5555)
        input:analog-stereo: Analog Stereo Input (priority 60)
        input:iec958-stereo: Digital Stereo (IEC958) Input (priority 55)
        off: Off (priority 0)
active profile: <output:analog-stereo+input:analog-stereo>
        alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#1: Scarlett 2i2 USB Analog Stereo
        alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor/#2: Monitor of Scarlett 2i2 USB Analog Stereo
        alsa_input.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo/#3: Scarlett 2i2 USB Analog Stereo
        analog-output: Analog Output (priority 9900, available: unknown)

        analog-input: Analog Input (priority 10000, available: unknown)

        iec958-stereo-input: iec958-stereo-input (priority 0, available: unknown)

        iec958-stereo-output: Digital Output (S/PDIF) (priority 0, available: unknown)

You can also find out your interface's names with

pactl list sources | grep Name:

In your case it is "alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor".

Then record audio with avconv by using exactly that name after the -i switch

avconv -f alsa -ac 2 -ar 48000 -f pulse \
-i alsa_output.usb-Focusrite_Scarlett_2i2_USB-00-USB.analog-stereo.monitor \
-acodec libvorbis -aq 6 test.ogg

In essence ommit the greater-than and smaller-than signs around the identifiers in your example and it should work.

Here is a tutorial about the usage and meaning of these commands: http://meshfields.de/linux-usb-audio-stream-recording/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.