<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 29, 2020, 7:04 AM Paul B Mahol <<a href="mailto:onemda@gmail.com">onemda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 5/29/20, Nicolas George <<a href="mailto:george@nsup.org" target="_blank" rel="noreferrer">george@nsup.org</a>> wrote:<br>
> Kerry Loux (12020-05-28):<br>
>> I'm trying to create an audio filter graph (in C/C++) that takes a number<br>
>> of inputs and mixes/splits/merges as necessary to produce a single stream<br>
>> with multiple channels.<br>
>><br>
>> I would like to be able to control which amerge input is mapped to which<br>
>> channel in the output stream. For example, if I'm merging two inputs, I<br>
>> want to control which is the left and which is the right channel.<br>
>> Similarly, for cases with more than two inputs, I'd like to know/control<br>
>> which output layout is being created and how each input is mapped.<br>
>><br>
>> Currently, I have an implementation that generates a stream with the<br>
>> correct individual channels, but mapped incorrectly. When I call<br>
>> av_filter_graph_config(), I get a message stating "Input channel layouts<br>
>> overlap; output layout will be determined by the number of distinct input<br>
>> channels," which seems like a clue.<br>
><br>
> Ignore the reply that tells you it is not possible, it is wrong and<br>
> unfounded.<br>
><br>
<br>
Your explanation bellow proves otherwise.<br>
<br>
amerge filter is of very limited functionality and should be<br>
deprecated and ultimately removed.<br>
<br>
> To make this work, you need to understand what channels layout are. If<br>
> you do not already, read the doc before trying further.<br>
><br>
> amerge has two modes of operation, depending on the channel layout of<br>
> its inputs.<br>
><br>
> If the inputs have channel layouts with completely different channels<br>
> (for example FL+FR+BL+BR on one input and FC+LF on the other), then the<br>
> output will be made of these combined channels. The channels will be<br>
> reordered to match the standard channel order of FFmpeg (with the given<br>
> example: FL+FR+FC+LF+BL+BR: notice that the two channels of the second<br>
> inputs were inserted between the channels of the first input).<br>
><br>
> If the inputs have channel layouts with the same channel in both (for<br>
> example FL+FR+FC merged with FL+FR+BL+BR), this cannot work, and amerge<br>
> falls back to ignoring the channel layout. In that case, amerge will<br>
> output all the channels in order: first the channels from the first<br>
> input, then the channels of the second input (in the example:<br>
> FL1+FR1+FC1+FL2+FR2+BL2+BR2).<br>
><br>
> Of course, the same happens if one of the inputs has no specified<br>
> channel layout.<br>
><br>
> It may happen that a latter filter will slap a channel layout on the<br>
> result. That channel layout would be random and irrelevant.<br>
><br>
> Hope this helped.<br>
><br>
> Regards,<br>
><br>
> --<br>
> Nicolas George<br>
><br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div><div dir="auto"><br></div><div dir="auto">Thanks Nicholas. I was able to get it to work using the method you described.</div><div dir="auto"><br></div><div dir="auto">Actually, I had tried it earlier, but I struggled because I was passing invalid channel layouts to my src buffer filters. My mistake was that I expected av_get_channel_layout_string() to produce values suitable for passing as a "channel_layout" option to my buffer filters.</div><div dir="auto"><br></div><div dir="auto">I may also consider Paul's suggestion to use a join filter instead, but I'm not sure that it will simplify anything for me since I'll likely still need splits and mixes for a general solution.</div><div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto"><br></div><div dir="auto">Kerry</div><div dir="auto"></div></div>