<p>The trick was to use amix=inputs=2</p>

<p>My error was thinking that I wanted to add another output stream to the track and the solution was to mix down the two tracks into one </p>

<pre><code>function stream {

ffmpeg -r 10  -threads 2 \
 -f x11grab -video_size 1600x900 -framerate 10 -i :0.0 \
 -f v4l2 -video_size 320x240 -framerate 10 -i /dev/video0 \
 -f alsa -ac 2 -i pulse                          \
 -f alsa -i plughw:1,0 \
 -filter_complex " \
amix=inputs=2;
[1:v]scale=170:-1,setpts=PTS-STARTPTS[fg]; \
[0:v]scale=1000:-1,setpts=PTS-STARTPTS[bg];  \
[bg][fg]overlay=W-w-10:10,format=yuv420p[out]; \
[out]crop=in_w:in_h-20:0:20[out]"\
 -map "[out]" \
 -map "2:a"  \
 -vcodec libx264 -preset veryfast -pix_fmt yuv420p -g 2 \
 -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3200k \
 -acodec libmp3lame -ar 44100 -b:a 256 \
 -ac 2 -f flv out.flv


  #-f alsa -i plughw:1,0
  #'rtmp://live-jfk.twitch.tv/app/'"$key"

}
</code></pre>

CC BY-SA 3.0
2015-04-21T08:01:54.017Z
2015-04-21T08:01:54.017Z
James Andino
<p>Here is what I have so far . I just dont know how to add plughw:1,0 into the command . </p>

<p>I have tested that recording does work on plughw:1,0 .</p>

<pre><code>function stream {

ffmpeg -r 10  -threads 2 \
 -f x11grab -video_size 1600x900 -framerate 10 -i :0.0 \
tasta-f v4l2 -video_size 320x240 -framerate 10 -i /dev/video0 \
 -f alsa -ac 2 -i pulse                          \
 -filter_complex " \
[1:v]scale=170:-1,setpts=PTS-STARTPTS[fg]; \
[0:v]scale=1000:-1,setpts=PTS-STARTPTS[bg];  \
[bg][fg]overlay=W-w-10:10,format=yuv420p[out]; \
[out]crop=in_w:in_h-20:0:20[out]"\
 -map "[out]" \
 -map "2:a"  \
 -vcodec libx264 -preset veryfast -pix_fmt yuv420p -g 2 \
 -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3200k \
 -acodec libmp3lame -ar 44100 -b:a 256 \
 -ac 2 -f flv out.flv


  #-f alsa -i plughw:1,0

  #'rtmp://live-jfk.twitch.tv/app/'"$key"

}
</code></pre>

CC BY-SA 3.0
2015-04-21T08:00:01.287Z
I can`t image why some one would down vote this
James Andino
CC BY-SA 3.0
2015-04-21T12:09:40.147Z
Possibly because it doesn't seem to ask a question. Try to reformulate your post so that it better conforms to SE guidelines.
Jim Mack
CC BY-SA 3.0
2015-04-21T17:49:07.867Z
if it needs a ? mark that bad get to editing . It's to easy to hit a single button to compensate for personal ocd.
James Andino
CC BY-SA 3.0
2015-04-21T18:41:26.967Z
Personal OCD? There are clear guidelines for how the SE sites are intended to be used. If you don't feel like conforming to them, at least accept the consequences. I wasn't the original downvoter, but based on your attitude I'm now the second one.
Jim Mack
CC BY-SA 3.0
2015-04-22T07:28:29.917Z
That's fair enough
James Andino
<ffmpeg>
FFMPEG 2 audio track input
James Andino
# FFMPEG 2 audio track input

(Asked by: username_0 on 2015-04-21)

Here is what I have so far . I just dont know how to add plughw:1,0 into the command . 
I have tested that recording does work on plughw:1,0 .
function stream {

ffmpeg -r 10  -threads 2 \
 -f x11grab -video_size 1600x900 -framerate 10 -i :0.0 \
tasta-f v4l2 -video_size 320x240 -framerate 10 -i /dev/video0 \
 -f alsa -ac 2 -i pulse                          \
 -filter_complex " \
[1:v]scale=170:-1,setpts=PTS-STARTPTS[fg]; \
[0:v]scale=1000:-1,setpts=PTS-STARTPTS[bg];  \
[bg][fg]overlay=W-w-10:10,format=yuv420p[out]; \
[out]crop=in_w:in_h-20:0:20[out]"\
 -map "[out]" \
 -map "2:a"  \
 -vcodec libx264 -preset veryfast -pix_fmt yuv420p -g 2 \
 -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3200k \
 -acodec libmp3lame -ar 44100 -b:a 256 \
 -ac 2 -f flv out.flv


  #-f alsa -i plughw:1,0

  #'rtmp://live-jfk.twitch.tv/app/'"$key"

}

**Tags:** ffmpeg

> **Comments:**
> **username_0**: I can`t image why some one would down vote this  
> **username_1**: Possibly because it doesn't seem to ask a question. Try to reformulate your post so that it better conforms to SE guidelines.  
> **username_0**: if it needs a ? mark that bad get to editing . It's to easy to hit a single button to compensate for personal ocd.  
> **username_1**: Personal OCD? There are clear guidelines for how the SE sites are intended to be used. If you don't feel like conforming to them, at least accept the consequences. I wasn't the original downvoter, but based on your attitude I'm now the second one.  
> **username_0**: That's fair enough  

---

## 1 answers

### Answer by username_0 on 2015-04-21. Score: 1

The trick was to use amix=inputs=2
My error was thinking that I wanted to add another output stream to the track and the solution was to mix down the two tracks into one 
function stream {

ffmpeg -r 10  -threads 2 \
 -f x11grab -video_size 1600x900 -framerate 10 -i :0.0 \
 -f v4l2 -video_size 320x240 -framerate 10 -i /dev/video0 \
 -f alsa -ac 2 -i pulse                          \
 -f alsa -i plughw:1,0 \
 -filter_complex " \
amix=inputs=2;
[1:v]scale=170:-1,setpts=PTS-STARTPTS[fg]; \
[0:v]scale=1000:-1,setpts=PTS-STARTPTS[bg];  \
[bg][fg]overlay=W-w-10:10,format=yuv420p[out]; \
[out]crop=in_w:in_h-20:0:20[out]"\
 -map "[out]" \
 -map "2:a"  \
 -vcodec libx264 -preset veryfast -pix_fmt yuv420p -g 2 \
 -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3200k \
 -acodec libmp3lame -ar 44100 -b:a 256 \
 -ac 2 -f flv out.flv


  #-f alsa -i plughw:1,0
  #'rtmp://live-jfk.twitch.tv/app/'"$key"

}


---

