You are not logged in.

#1 2014-07-03 19:50:59

zoomshorts
Member
Registered: 2014-04-28
Posts: 6

ALSA aloop and .asoundrc cannot output system audio to ffmpeg.

I have seen other threads about this but I cannot get their recommendations to work. My goal is ffmpeg screen and audio capture. Screen capture is working great, but alsa audio capture is not working. I am not using pulseaudio as it did not work when I tried it and would prefer not to in general.
I am using an FFMPEG command that I wrote to fit youtube's recommended guidelines:

ffmpeg -f x11grab -framerate 60 -video_size 1920x1080 -i $DISPLAY -f alsa -ac 2 -i hw:2,1 -vcodec libx264 -profile:v high444 -preset ultrafast -bf 2 -qp 0 -crf 0 -cmp chroma -coder ac -threads 4 -acodec libfdk_aac -profile:a aac_low -b:a 393216 -ar 96000 -channels 2 youtube.mp4

Output of aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC898 Analog [ALC898 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC898 Digital [ALC898 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 2: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

My .asoundrc that should be playing all system sounds on the loop, hw:2,0 :

pcm.!default {
  type asym
  playback.pcm "RealAndLoop"
  capture.pcm "hw:0,0"
}

pcm.RealAndLoop {
  type plug
  slave.pcm RealOrLoop
  route_policy "duplicate"
}

pcm.RealOrLoop {
  type multi
  slaves.a.pcm pcm.MixReal
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoop
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave
  bindings.2.channel 0
  bindings.3.slave
  bindings.3.channel 1
}

pcm.MixReal {
  type dmix
  ipc_key 1001
  ipc_key_add_uid 0
  slave {
    pcm "hw:0,0"
    }
}

pcm.MixLoop {
  type dmix
  ipc_key 1010
  ipc_key_add_uid 0
  slave {
    pcm "hw:2,0"
    }
}

Also this rc only plays one audio client at a time. The small one on archwiki:

pcm.dsp {
    type plug
    slave.pcm "dmix"
}

fixes that but obviously wont accomplish what I'm trying to do here. Is there a way to combine them?

Am I missing something.  doing something wrong, or is this a problem with my sound card?


| CM 431/CM212+/XFX 7870/ASRK ex4/INT 3570k @ 4.8ghz/700W PSU/512G vtx4/1TB bar | arch/aweseomWM/rice

Offline

#2 2014-07-04 15:13:07

raggerv8
Member
From: Sweden
Registered: 2010-07-01
Posts: 113
Website

Re: ALSA aloop and .asoundrc cannot output system audio to ffmpeg.

As I wrote to you on Reddit, try just using SimpleScreenRecorder.

Stable version in [community]: https://www.archlinux.org/packages/simplescreenrecorder

Git version in [AUR]: https://aur.archlinux.org/packages/simp … corder-git


Brottweiler at #archlinux

Use IRC and Mumble for online communication!

Offline

#3 2014-07-04 17:51:07

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: ALSA aloop and .asoundrc cannot output system audio to ffmpeg.

Take a look here.

Offline

Board footer

Powered by FluxBB