Commit c1fa846d authored by Paul B Mahol's avatar Paul B Mahol

avfilter: add sidechain compress audio filter

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent af08d8bf
......@@ -24,6 +24,7 @@ version <next>:
- Random filter
- deband filter
- AAC fixed-point decoding
- sidechaincompress audio filter
version 2.7:
......
......@@ -622,6 +622,7 @@ slope
Specify the band-width of a filter in width_type units.
@end table
@anchor{amerge}
@section amerge
Merge two or more audio streams into a single multi-channel stream.
......@@ -2020,6 +2021,7 @@ Applies only to double-pole filter.
The default is 0.707q and gives a Butterworth response.
@end table
@anchor{pan}
@section pan
Mix channels with specific gain levels. The filter accepts the output
......@@ -2121,6 +2123,66 @@ At end of filtering it displays @code{track_gain} and @code{track_peak}.
Convert the audio sample format, sample rate and channel layout. It is
not meant to be used directly.
@section sidechaincompress
This filter acts like normal compressor but has the ability to compress
detected signal using second input signal.
It needs two input streams and returns one output stream.
First input stream will be processed depending on second stream signal.
The filtered signal then can be filtered with other filters in later stages of
processing. See @ref{pan} and @ref{amerge} filter.
The filter accepts the following options:
@table @option
@item threshold
If a signal of second stream raises above this level it will affect the gain
reduction of first stream.
By default is 0.125. Range is between 0.00097563 and 1.
@item ratio
Set a ratio about which the signal is reduced. 1:2 means that if the level
raised 4dB above the threshold, it will be only 2dB above after the reduction.
Default is 2. Range is between 1 and 20.
@item attack
Amount of milliseconds the signal has to rise above the threshold before gain
reduction starts. Default is 20. Range is between 0.01 and 2000.
@item release
Amount of milliseconds the signal has to fall bellow the threshold before
reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
@item makeup
Set the amount by how much signal will be amplified after processing.
Default is 2. Range is from 1 and 64.
@item knee
Curve the sharp knee around the threshold to enter gain reduction more softly.
Default is 2.82843. Range is between 1 and 8.
@item link
Choose if the @code{average} level between all channels of side-chain stream
or the louder(@code{maximum}) channel of side-chain stream affects the
reduction. Default is @code{average}.
@item detection
Should the exact signal be taken in case of @code{peak} or an RMS one in case
of @code{rms}. Default is @code{rms} which is mainly smoother.
@end table
@subsection Examples
@itemize
@item
Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
depending on the signal of 2nd input and later compressed signal to be
merged with 2nd input:
@example
ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
@end example
@end itemize
@section silencedetect
Detect silence in an audio stream.
......
......@@ -80,6 +80,7 @@ OBJS-$(CONFIG_LOWPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_PAN_FILTER) += af_pan.o
OBJS-$(CONFIG_REPLAYGAIN_FILTER) += af_replaygain.o
OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o
OBJS-$(CONFIG_SIDECHAINCOMPRESS_FILTER) += af_sidechaincompress.o
OBJS-$(CONFIG_SILENCEDETECT_FILTER) += af_silencedetect.o
OBJS-$(CONFIG_SILENCEREMOVE_FILTER) += af_silenceremove.o
OBJS-$(CONFIG_TREBLE_FILTER) += af_biquads.o
......
This diff is collapsed.
......@@ -96,6 +96,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(PAN, pan, af);
REGISTER_FILTER(REPLAYGAIN, replaygain, af);
REGISTER_FILTER(RESAMPLE, resample, af);
REGISTER_FILTER(SIDECHAINCOMPRESS, sidechaincompress, af);
REGISTER_FILTER(SILENCEDETECT, silencedetect, af);
REGISTER_FILTER(SILENCEREMOVE, silenceremove, af);
REGISTER_FILTER(TREBLE, treble, af);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 28
#define LIBAVFILTER_VERSION_MINOR 29
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment