[FFmpeg-devel] [PATCH] doc: document amerge filter as an alternative for the -map_channel limitation.

Tim Nicholson nichot20 at yahoo.com
Fri Jan 13 11:42:18 CET 2012

Tim Nicholson <nichot20 at yahoo.com> wrote:- 

> Hi Clément
> [...]

> Overall LGTM

OK having had a chance to test this now I have found that your proposal:-

> +If you need this feature, a possible workaround is to use the @emph{amerge}
> +filter. For example, if you need to merge a media (here @file{input.mkv}) with 2
> +mono audio streams into one single stereo channel audio stream (and keep the
> +video stream):
> +
> + at example
> +ffmpeg -i input.mkv -f lavfi -i "
> +amovie=input.mkv:si=1 [a1];
> +amovie=input.mkv:si=2 [a2];
> +[a1][a2] amerge" -c:a pcm_s16le -c:v copy output.mkv
> + at end example
> +

Did not work for me because as my source was pcm_s24le the following took place:-

[amerge @ 0x17f9a60] in1:mono + in2:mono -> out:stereo
[aconvert @ 0x17ef2e0] fmt:s32 cl:stereo planar:0 -> fmt:s16 cl:mono planar:0

i.e. the automatically inserted aconvert turned the stereo back into mono.

I also think your stream indicies should start at 0 not 1. (when I used 1 and 2 I got tracks 2 and 3)

I used:-

ffmpeg -i in.mov -f lavfi -i "
amovie=in.mov:si=0 , aconvert=s16:mono:planar [a1];
amovie=in.mov:si=1 , aconvert=s16:mono:planar [a2];
[a1][a2] amerge" -vf " scale=720:576 " -c:a pcm_s16le -ar 48k -ac 2 -c:v copy out.mov

 and got exactly what I expected.


More information about the ffmpeg-devel mailing list