From patchwork Thu Apr 6 08:49:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Warburton X-Patchwork-Id: 3317 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp558407vss; Thu, 6 Apr 2017 01:56:20 -0700 (PDT) X-Received: by 10.223.172.133 with SMTP id o5mr25089292wrc.23.1491468980232; Thu, 06 Apr 2017 01:56:20 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l5si28141185wma.162.2017.04.06.01.56.19; Thu, 06 Apr 2017 01:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@johnwarburton.net; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4AA21688341; Thu, 6 Apr 2017 11:56:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECB4668833F for ; Thu, 6 Apr 2017 11:56:07 +0300 (EEST) Received: by mail-oi0-f48.google.com with SMTP id d2so44008856oig.1 for ; Thu, 06 Apr 2017 01:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnwarburton.net; s=google; h=mime-version:from:date:message-id:subject:to; bh=feFz8QpeC1GdHDPKbheDaxBubX9aLKvN5Rzmad1mfjo=; b=Mw10XUbvxcldtreWtmtwIHt4D8AITTt64Foky1kme/XvFWBd88/dxvFMD83XI9D1U/ eFoeQg1hsd/hbrncQdj6m9b0YWb0t+3SRmU9UnRuA3tD8BinOKC9uEZZf81WUBA07m3H WajkIrdj87XT6CjmnePhRJoisI2flG2XD9ij4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=feFz8QpeC1GdHDPKbheDaxBubX9aLKvN5Rzmad1mfjo=; b=gwqL8FfRF4mO8POWgYuIQampZtTokm9E5cRGdeN9YK1nHVLza2yXYCshmAUl+rCR4a S5c5poDezBhL5FNyYzhH1jkOpn0rjqrLoEeedIle9kko70wkAql2NcD8+b6VEe59a5G8 5gHzdWRWxvwB04Db7r1pwzocjv8yWoZrbi+GBq/56jM3xr01aAD1gUJnxGGdskVAEC7q sRoPuvuKGzDZ183JZWqn8WhbatOgsYREVNgCTVKOWUP1ILE7eZbiWAY4WJ5nr09JakqK ry7KLPdLbemNAgUl915hqJCT1xSo/+Cg9H98Xi+UlAHu2G7duH43AS6sv5JHT0CTu+Tj SJNg== X-Gm-Message-State: AFeK/H2Dp4KsU+BqNRxfJfxRvvvVjfIdTkly4bc+mKaZSp7Xq5Vp4OsMKXigp6/0Mt/VWmjiCIq135zZ+ZORvg== X-Received: by 10.157.17.40 with SMTP id g37mr16960304ote.259.1491468561840; Thu, 06 Apr 2017 01:49:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.13.66 with HTTP; Thu, 6 Apr 2017 01:49:21 -0700 (PDT) From: John Warburton Date: Thu, 6 Apr 2017 09:49:21 +0100 Message-ID: To: FFmpeg development discussions and patches , justin.ruggles@gmail.com Subject: [FFmpeg-devel] Patch: filter af_amix inputs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 { "longest", "Duration of longest input.", 0, AV_OPT_TYPE_CONST, { .i64 = DURATION_LONGEST }, INT_MIN, INT_MAX, A|F, "duration" }, --- John Warburton Tonmeister, Director, Associate Lecturer, University of Surrey Department of Music and Media --- 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" },