[FFmpeg-devel] [PATCH] af_mix: mix two audio streams

Nicolas George nicolas.george at normalesup.org
Tue Dec 13 17:08:26 CET 2011

Le tridi 23 frimaire, an CCXX, Matthieu Bouron a écrit :
> Hi there,
> Here is a first attempt to write an audio filter which merge two audio
> streams.
> Usage is:
> ffplay -f lavfi "amovie=test1.mp3[a];amovie=test2.mp3[b];[a][b]mix=0.7:0.3[out]"
> The volume of each streams can be configured and default to 0.5:0.5 is
> not specified. It only support two s16 audio streams with same sample
> rate.
> Feel free to comment.

This is a much asked for feature, but I do not like the design you adopted.
I think your version is confusing two different tasks: merging the streams,
and mixing the channels with configurable coefficients. Thus, it only
satisfies the most basic needs.

I believe that it is better to separate both tasks: first merging a
n-channels streams and a p-channels streams into a stream with n+p channels,
and then mixing the channels together if necessary.

For the first task, I started some time ago a "amerge" filter. The work as I
left it is there:
I intend to start working on it again soon.

For the second task, the pan filter can do almost anything we may need from


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111213/eb6f55cc/attachment.asc>

More information about the ffmpeg-devel mailing list