Hi Cristian,

On Sun, Aug 28, 2016 at 12:50:59PM +0200, Cristian Ionescu-Idbohrn wrote:
> On Sun, 28 Aug 2016, Muammar El Khatib wrote:
> >
> > That was the idea. After your report, I realized mkchromecast is
> > mostly useless in systems without pulseaudio right now. I will
> > remove that dependency in next releases.
>
> Great.
>
> > Yesterday, I was already playing with ffmpeg + ALSA to capture
> > audio, but I think it will be a complicated solution to implement
> > (cards' and devices' names may change from system to system).  I had
> > forgotten about GStreamer completely. Reading just a bit about it,
> > it may be a possible solution.
>
> Nice.
>
> I'll be watching this space and be ready to test mkchromecast again
> whenever possible.

Would you mind testing if this procedure makes possible to record your audio
using alsa?

1. Do
    modprobe snd-aloop

2. Add the following content to ~/.asoundrc

pcm.!default {
  type asym
  playback.pcm "LoopAndReal"
  #capture.pcm "looprec"
  capture.pcm "hw:0,0"
}

pcm.looprec {
    type hw
    card "Loopback"
    device 1
    subdevice 0
}

pcm.LoopAndReal {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}

pcm.mdev {
  type multi
  slaves.a.pcm pcm.MixReale
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}

pcm.MixReale {
  type dmix
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

pcm.MixLoopback {
  type dmix
  ipc_key 1025
  slave {
    pcm "hw:Loopback,0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

3. Install ffmpeg, and execute this command while playing anything in your
   computer:

    ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0 -t 30 out.wav

Does ffmpeg capture the audio in out.wav?. I tested this in a Virtualbox using
debian with pure alsa (I was lazy, and didn't reconfigure everything in my own
laptop).  I think the procedure above did the trick but sound was crippled
(maybe related to Virtualbox).

Thanks.

--
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | http://proyectociencia.org
  ,''`.
 : :' :
 `. `'
   `-

Reply via email to