Changes between Version 5 and Version 6 of Capture/ALSA


Ignore:
Timestamp:
Nov 12, 2014, 10:13:23 PM (5 years ago)
Author:
c-14
Comment:

Add recording audio from application examples.

Legend:

Unmodified
Added
Removed
Modified
  • Capture/ALSA

    v5 v6  
    132132= Examples =
    133133
    134 == Grab an audio from your microphone ==
     134== Record audio from your microphone ==
    135135
    136136When doing screencast recordings, you usually want to record your voice too:
     
    142142ffmpeg -f alsa -ac 1 -ar 44100 -i default:CARD=ICH5 -t 30 out.wav
    143143}}}
     144
     145== Record audio from an application ==
     146Load the snd_aloop module:
     147{{{
     148modprobe snd-aloop pcm_substreams=1
     149}}}
     150Set the default ALSA audio output to one substream of the Loopback device in your .asoundrc (or /etc/asound.conf)
     151{{{
     152# .asoundrc
     153pcm.!default { type plug slave.pcm "hw:Loopback,0,0" }
     154}}}
     155You can now record audio from a running application using:
     156{{{
     157ffmpeg -f alsa -ac 2 -ar 44100 -i hw:Loopback,1,0 out.wav
     158}}}
     159
     160== Record audio from an application while also routing the audio to an output device ==
     161Load the snd_aloop module:
     162{{{
     163modprobe snd-aloop pcm_substreams=1
     164}}}
     165Set up your .asoundrc (or /etc/asound.conf) like so:
     166{{{
     167# .asoundrc
     168pcm.multi {
     169    type route;
     170    slave.pcm {
     171        type multi;
     172        slaves.a.pcm "output";
     173        slaves.b.pcm "loopin";
     174        slaves.a.channels 2;
     175        slaves.b.channels 2;
     176        bindings.0.slave a;
     177        bindings.0.channel 0;
     178        bindings.1.slave a;
     179        bindings.1.channel 1;
     180        bindings.2.slave b;
     181        bindings.2.channel 0;
     182        bindings.3.slave b;
     183        bindings.3.channel 1;
     184    }
     185
     186    ttable.0.0 1;
     187    ttable.1.1 1;
     188    ttable.0.2 1;
     189    ttable.1.3 1;
     190}
     191
     192pcm.!default {
     193        type plug
     194        slave.pcm "multi"
     195}
     196
     197pcm.output {
     198        type hw
     199        card Headset
     200}
     201
     202pcm.loopin {
     203        type plug
     204        slave.pcm "hw:Loopback,0,0"
     205}
     206
     207pcm.loopout {
     208        type plug
     209        slave.pcm "hw:Loopback,1,0"
     210}
     211}}}
     212where the output pcm points to the output device you want the audio to go to.
     213
     214You can now record audio from a running application using:
     215{{{
     216ffmpeg -f alsa -ac 2 -ar 44100 -i loopout out.wav
     217}}}