<p>Inside a filtergraph, each pad is associated with a single stream. And a specifier such as <code>0:a</code> will match the first stream that qualifies. You need to specify two pads and fully specify the input streams.</p>
<pre><code>[0:a:0][0:a:1]amerge=inputs=2[a]
</code></pre>

CC BY-SA 4.0
2020-11-21T06:34:51.737Z
Will this throw an error if only one input audio stream is inputted? I'm using it in a kind of automated program, and some videos may only have one audio stream, while others may have 2.
pigeonburger
CC BY-SA 4.0
2020-11-21T08:01:17.530Z
No. of inputs should be equal to the inputs value of amerge.
Gyan
CC BY-SA 4.0
2020-11-21T04:48:53.333Z
2020-11-21T04:48:53.333Z
Gyan
<p>The error I'm getting is in the title.</p>
<p>I want to merge the two audio streams from a video into one (yes, I've checked if there is two and there is). This is the command I'm using:</p>
<pre><code>ffmpeg -i input.mp4 -filter_complex &quot;[0:v]scale=-2:720,format=yuv420p[v];[0:a]amerge=inputs=2[a]&quot; -map &quot;[v]&quot; -map &quot;[a]&quot; -c:v libx264 -crf 23 -preset medium -c:a aac -ar 44100 -ac 2 output.mp4
</code></pre>
<p>Any ideas why I could be getting the error?</p>

<video><ffmpeg><audio>
"Cannot find a matching stream for unlabeled input pad 2 on filter Parsed_amerge_2" ffmpeg
pigeonburger
# "Cannot find a matching stream for unlabeled input pad 2 on filter Parsed_amerge_2" ffmpeg

(Asked by: username_0 on 2020-11-20)

The error I'm getting is in the title.
I want to merge the two audio streams from a video into one (yes, I've checked if there is two and there is). This is the command I'm using:
ffmpeg -i input.mp4 -filter_complex "[0:v]scale=-2:720,format=yuv420p[v];[0:a]amerge=inputs=2[a]" -map "[v]" -map "[a]" -c:v libx264 -crf 23 -preset medium -c:a aac -ar 44100 -ac 2 output.mp4

Any ideas why I could be getting the error?

**Tags:** video, ffmpeg, audio


---

## 1 answers

### Answer by username_1 on 2020-11-21. Score: 0 | Accepted answer

Inside a filtergraph, each pad is associated with a single stream. And a specifier such as 0:a will match the first stream that qualifies. You need to specify two pads and fully specify the input streams.
[0:a:0][0:a:1]amerge=inputs=2[a]

> **Comments:**
> **username_0**: Will this throw an error if only one input audio stream is inputted? I'm using it in a kind of automated program, and some videos may only have one audio stream, while others may have 2.  
> **username_1**: No. of inputs should be equal to the inputs value of amerge.  

---

