[FFmpeg-devel] [PATCH] lavfi/pan: better handling of negative gains
barsnick at gmx.net
Sun Oct 9 04:49:14 EEST 2016
While trying to use pan to subtract two channels (actually to see whether a
two-channel file I have is effectively mono), I noticed that
"pan=mono|c0=-0.5*c0+0.5*c1" would work, while "pan=mono|c0=0.5*c0-0.5*c1"
would cause the parser to choke, expecting a '+'.
Using this (second) patch, you could now not only "check" for channel
differences, but also eliminate centered stereo signals, like an "out of
phase stereo" ("karaoke") filter.
Meanwhile I also noticed that "pan=mono|c0<-0.49*c0+0.51*c1" would be
incorrectly amplified by a factor of 50 (= 1/(-0.49+0.51)), which can lead
to clipping with any non-related inputs, as the negative gain factor
actually only inverts the input's phase, not its level. This is fixed in
the first patch.
Moritz Barsnick (2):
lavfi/pan: renormalize negative gain coefficients properly
lavfi/pan: allow negative gain parameters also for other inputs than
the first named
doc/filters.texi | 2 +-
libavfilter/af_pan.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
More information about the ffmpeg-devel