From: Eric Wong <normalperson@yhbt.net>
To: sox-users@lists.sourceforge.net
Subject: Re: too many open files
Date: Wed, 16 Nov 2016 09:38:08 +0000 [thread overview]
Message-ID: <20161116093808.GA19527@starla> (raw)
In-Reply-To: <20161111131241.r46ao53w3nijql2g@fastmail.com>
"Peter P." <peterparker@fastmail.com> wrote:
> I managed to get things to work this way. Nevertheless Eric, if you have
> a moment to peek into the code and see why sox is keeping files open, it
> would be fantastic and could prevent similar questions coming up again.
Most of the sox input methods are parallel (mix/merge/etc), so
those files all need to be kept open for the duration of the
invocation.
Based on a quick look, it seems serial methods
(concatenate/sequence) can handle closing just fine;
it might make the code a little more complex.
Off the top of my head, "gain -n" needs rewindability, but
that seems to use a temporary file, anyways (since sox is
equipped to handle pipes).
One major issue of delaying fopen() is the files may disappear
from the filesystem immediately after sox opens them started; so
delaying opening them cannot be the default behavior, and needs
to be made an option, instead...
I know I often unlink files ASAP after opening them when I'm
testing different effects on a small filesystem (tmpfs).
But yeah, even command-line args are likely to exceed the limits
of your OS command size, probably before nofile limits (ulimit
-n), so I would favor find + xargs, instead of globbing;
something like:
export FMT='-ts32 -c2 -r48000'
find $DIR -name '*.part*.wav' -type f -print0 | \
xargs -0 -n1 sh -c 'sox "$@" $FMT -' -- |
sox $FMT - out.wav
This avoids nofile limits as well as any command-line length
limitations the OS might have.
(I'm embarrassed for not thinking of this from my original reply :x)
------------------------------------------------------------------------------
next prev parent reply other threads:[~2016-11-16 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 9:50 too many open files Peter P.
2016-11-09 10:02 ` Erich Eckner
2016-11-11 13:12 ` Peter P.
2016-11-16 9:38 ` Eric Wong [this message]
2016-11-09 11:18 ` Eric Wong
2016-11-10 0:01 ` fmiser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-users
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161116093808.GA19527@starla \
--to=sox-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).