Changes between Version 2 and Version 3 of Capture/ALSA


Ignore:
Timestamp:
Jul 5, 2012, 8:01:14 PM (7 years ago)
Author:
burek
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Capture/ALSA

    v2 v3  
    88= Selecting the input card =
    99
    10 '''input_device''' tells FFmpeg which audio capturing device`/`card you would like to use. To get a list of all supported devices, you can type '''arecord -l''' (small L) or '''arecord -L''' (longer output).
     10'''input_device''' tells FFmpeg which audio capturing card`/`device you would like to use. To get the list of all installed cards on your machine, you can type '''arecord -l''' (small L) or '''arecord -L''' (longer output).
    1111
    12 So, first, list your recording devices:
     12So, first, list your recording cards/devices:
    1313{{{
    1414# arecord -l
     
    3232}}}
    3333
    34 We can see there are 2 audio cards that provide capturing capabilities, namely "'''card 0'''" (Intel ICH5) and "'''card 1'''" (Microphone on the USB web cam). The easiest thing to do is to reference each of them directly using "'''-f alsa -i hw:0'''" or "'''-f alsa -i hw:1'''":
     34We can see there are 2 audio cards installed that provide capturing capabilities, namely "'''card 0'''" (Intel ICH5) and "'''card 1'''" (Microphone on the USB web cam). The easiest thing to do is to reference each of them directly using "'''-f alsa -i hw:0'''" or "'''-f alsa -i hw:1'''":
    3535{{{
    3636ffmpeg -f alsa -i hw:1 -t 30 out.wav
    3737}}}
    38 That will give us a 30 seconds WAV audio output, recorded from our USB camera's default recording device (microphone). The default recording device can be selected using "alsamixer" tool (see below) or specifying the device using an additional parameter '''hw:<X>,<Y>''', where <X>=card, <Y>=device. For example, to select "MIC2 ADC" from Intel card, we would use:
     38That will give us a 30 seconds WAV audio output, recorded from our USB camera's '''default recording device''' (microphone). The default recording device can be selected using "alsamixer" tool (see below) or specifying the device using an additional parameter Y in '''hw:<X>,<Y>''', where <X>=card, <Y>=device. For example, to select "MIC2 ADC" from Intel card (look above at the list), we would use:
    3939{{{
    4040ffmpeg -f alsa -i hw:0,2 -t 30 out.wav
    4141}}}
    42 The best way is to select your default device with "alsamixer" tool, because some audio cards have complicated way of selecting the default input through the FFmpeg's command line.
     42The best way is to select your card and default recording device with "alsamixer" tool, because some audio cards have a complicated way of selecting the default input through the FFmpeg's command line.
    4343
    4444== Surviving the reboot ==
    4545
    46 But, '''if you reboot''' your machine, you will notice sometimes your cards get reordered, so "card 0" is listed as USB Audio and "card 1" is listed as Intel audio card. You might want to play with [http://www.reactivated.net/writing_udev_rules.html udev rules], but there is an easier solution for this. Typing '''arecord -L''' will give us a little bit more detailed listing of recording devices:
     46If you reboot your machine, you will notice sometimes your cards get reordered, so "card 0" is listed as USB Audio and "card 1" is listed as Intel audio card. You might want to play with [http://www.reactivated.net/writing_udev_rules.html udev rules], but there is an easier solution for this. Typing '''arecord -L''' will give us a little bit more detailed listing of recording devices:
    4747{{{
    4848#!html
     
    109109</pre>
    110110}}}
    111 This way, you're always asking for the input from that certain device and will never mix things up.
     111This way, you're always asking for the input from that certain device (the default recording device from the USB Audio device) and will never mix things up.
    112112
    113113== ALSA mixer tool ==