[FFmpeg-devel] Patch: filter af_amix inputs

Michael Niedermayer michael at niedermayer.cc
Fri Apr 7 12:25:35 EEST 2017


On Thu, Apr 06, 2017 at 09:49:21AM +0100, John Warburton wrote:
> Dear All,
> 
> While needing automatically to mix several hundred audio files, I
> noticed that the libavfilter module af_amix.c (audio filter 'amix') is
> hard-coded to limit inputs to 32. Of course, I believe this to be
> sensible as no doubt you do, too.
> 
> However, because the code appears to be written robustly, it was
> trivial to increase the limit to 1024 and, on a fast machine with SATA
> drives, I have used FFmpeg to mix simultaneously over 400 16-bit
> stereo wav files (48kHz sample rate) at approximately 2 x realtime. It
> starts very slowly, but speed soon builds up.
> 
> Naturally, memory use increased. But the job was done. It's generating
> files for a sound installation in an art exhibition in Brighton, UK,
> where many hundreds of migrant birds' songs must be heard together
> ("SWAY" at the ONCA Gallery).
> 
> Below is the very trivial patch in case the result of this experiment
> is of interest.
> 
> Thank you for all the work you do to make FFmpeg so incredibly useful.
> J
> 
> --- libavfilter/af_amix.c.orig 2017-04-05 22:26:26.326379600 +0100
> +++ libavfilter/af_amix.c 2017-04-05 18:00:59.291196000 +0100
> @@ -177,7 +177,7 @@
>  #define F AV_OPT_FLAG_FILTERING_PARAM
>  static const AVOption amix_options[] = {
>      { "inputs", "Number of inputs.",
> -            OFFSET(nb_inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 32, A|F },
> +            OFFSET(nb_inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 1024, A|F },
>      { "duration", "How to determine the end-of-stream.",
>              OFFSET(duration_mode), AV_OPT_TYPE_INT, { .i64 =
> DURATION_LONGEST }, 0,  2, A|F, "duration" },
>          { "longest",  "Duration of longest input.",  0,
> AV_OPT_TYPE_CONST, { .i64 = DURATION_LONGEST  }, INT_MIN, INT_MAX,
> A|F, "duration" },
> 

this patch is corrupted by linebreaks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170407/0b628885/attachment.sig>


More information about the ffmpeg-devel mailing list