Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im try to stream my desktop, and two audio: system output, and mic. Im using this command, but the audio from my system (hw:0,0) dont hear in output file...

avconv \
-f alsa -i pulse \
-f alsa -i hw:0,0 \
-f x11grab -r 10 -s 1600x900 -i :0.0 \
-map 0:a -map 1:a -map 2:v \
-acodec libvorbis -ab 160k \
-vcodec libvpx \
-threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 \
-y desktop-recording.webm;

If I run this command but without frist input, the sound is recorderd fine:

avconv \
-f alsa -i hw:0,0 \
-f x11grab -r 10 -s 1600x900 -i :0.0 \
-map 0:a -map 1:v \
-acodec libvorbis -ab 160k \
-vcodec libvpx \
-threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 \
-y desktop-recording.webm;

How I can stream/record all 3 inputs?

Note: this is command output:

gazambuja@linux:~$ avconv -ac 2 -f alsa -i pulse -f alsa -i hw:0,0 -f x11grab -r 10 -s 1600x900 -i :0.0 -map 0:a -map 1:a -map 2:v -acodec libvorbis -ab 160k -vcodec libvpx -threads 4 -deadline realtime -cpu-used 0 -qmin 2 -qmax 5 -y desktop-recording.webm; mplayer desktop-recording.webm 
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:52:53 with gcc 4.7.2
[alsa @ 0x96df900] capture with some ALSA plugins, especially dsnoop, may hang.
[alsa @ 0x96df900] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'pulse':
  Duration: N/A, start: 1364262041.999468, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[alsa @ 0x96e0320] Estimating duration from bitrate, this may be inaccurate
Input #1, alsa, from 'hw:0,0':
  Duration: N/A, start: 10169.999299, bitrate: N/A
    Stream #1.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0x96e13e0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1600 height: 900
[x11grab @ 0x96e13e0] shared memory extension  found
[x11grab @ 0x96e13e0] Estimating duration from bitrate, this may be inaccurate
Input #2, x11grab, from ':0.0':
  Duration: N/A, start: 1364262042.244502, bitrate: 460799 kb/s
    Stream #2.0: Video: rawvideo, bgra, 1600x900, 460799 kb/s, 10 tbr, 1000k tbn, 10 tbc
Incompatible pixel format 'bgra' for codec 'libvpx', auto-selecting format 'yuv420p'
[buffer @ 0x96fbc20] w:1600 h:900 pixfmt:bgra
[avsink @ 0x96e0ec0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x96d4460] w:1600 h:900 fmt:bgra -> w:1600 h:900 fmt:yuv420p flags:0x4
[libvpx @ 0x96d46a0] v1.1.0
Output #0, webm, to 'desktop-recording.webm':
  Metadata:
    encoder         : Lavf53.21.1
    Stream #0.0: Audio: libvorbis, 48000 Hz, 2 channels, s16, 160 kb/s
    Stream #0.1: Audio: libvorbis, 48000 Hz, 2 channels, s16, 160 kb/s
    Stream #0.2: Video: libvpx, yuv420p, 1600x900, q=2-5, 200 kb/s, 1k tbn, 10 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
  Stream #1:0 -> #0:1 (pcm_s16le -> libvorbis)
  Stream #2:0 -> #0:2 (rawvideo -> libvpx)
share|improve this question
up vote 2 down vote accepted

It is muxing your audio, but you are mapping your audio to two separate streams.

Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
Stream #1:0 -> #0:1 (pcm_s16le -> libvorbis)

By default most video players play the first audio and video stream in the file. E.g. when you play your video in VLC, you can right click Audio -> Audio Track -> and then choose either Audio 1 or Audio 2.

You can use the amerge filter to merge audio if you want that?

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .