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

Nicolas George nicolas.george at normalesup.org
Sun Apr 1 12:26:42 CEST 2012


Le tridi 13 germinal, an CCXX, Clément Bœsch a écrit :
> Adding the levels, it begins to look a bit insane IMO.

That is a bit exaggerated, but I grant you it is somewhat overly verbose.

> Maybe the "mix" filter could be added in the "pan" one, so it could use
> the internals?

Possibly. Another, IMHO cleaner solution, would be to tweak the parser to be
able to write:

	pan=stereo:mix=0.4+0.6

and it would automatically fill the matrix as if the coefficients have been
given as "stereo:c0=0.4*c0+0.6*c2:c1=0.4*c1+0.6*c3".

A kind of macro-expansion, in fact (but IMHO, simpler written avoiding text
operations).

> (A pan cmd line could be generated in the mix init func and use amerge
> callbacks)

I am not sure what you mean, but it looks fragile and ad-hoc.

Ad-hoc is my main problem with this patch: Matthieu wrote it for the case he
needs to solve, but it stops working on most other case. For example mixing
a mono commentary on a stereo music will not work.

Adding a special case for a very common need is ok, of course, but I do not
believe that mixing with the same channel layout is that much more common
than mixing with different layouts, or mixing from more than two streams.

Regards,

-- 
  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/20120401/b0219766/attachment.asc>


More information about the ffmpeg-devel mailing list