[FFmpeg-devel] [PATCH] Support for reducing from 5.1 and 4.0audio?to stereo audio
Wed Oct 31 22:50:08 CET 2007
On Wed, 31 Oct 2007, Michael Niedermayer wrote:
> On Wed, Oct 31, 2007 at 11:01:14PM +0200, Jan Knutar wrote:
> > The poor user can always compensate by turning the volume up, and suffer
> > the tiny little extra noise... But how does one compensate for the
> > argh-my-ears-are-bleeding sensation that clipping causes? :)
> turn the volume down before the downmixing ;)
> anyway the question really is how big the maximum amplitude is after
> the downmixing but before the downscaling with valid streams
> if any cliping by more then 1% is needed then the samples must be
> downscaled more to avoid that
> or to say it differently if theres nothing in the codec specs which
> gurantees that the sum of channels fits in 16bit then we must downscale
> well unless someone finally implements 32bit audio support
> also some formats can store downmixing coeffs and such which might be
> helpfull here.
AC3 is such a format. There are center and surround mixing levels.
The spec defines how to create a two-channel downmix (actually two, one for
stereo and one with matrix encoded surround). From my reading, it sounds
like one is supposed to use mixing coefficients that prevent clipping.
The actual coefficients used must be scaled downwards so that
arithmetic overflow does not occur if all channels contributing to
a downmix signal happen to be at full scale.
The ac3 spec is available as A/52b from atsc.org. The relevent sections are:
184.108.40.206 cmixlev: Center Mix Level, 2 bits
220.127.116.11 surmixlev: Surround Mix Level, 2 bits
7.8.2 Downmixing Into Two Channels.
D2.3.2 dmixmod: Preferred Stereo Downmix Mode, 2 bits
D2.3.6 lorosurmixlev: Lo/Ro Surround Mix Level, 3 bits
More information about the ffmpeg-devel