[Libav-user] Using libav to insert silence at the beginning of an audio clip

Paul B Mahol onemda at gmail.com
Tue Mar 21 17:53:15 EET 2017


On 3/21/17, Chris Hennes <chennes at pioneerlibrarysystem.org> wrote:
> The software I am writing allows a user to combine multiple
> potentially-overlapping audio clips by specifying an in and out point for
> each clip, plus when in the final stream that clip starts. I'm trying to
> string together a single filter graph that will do this and am struggling
> with the start point bit. My thought was to take each of the audio files and
> construct a filter chain for them that inserts silence of the required
> length at the beginning, then the atrim'ed audio clip, then an apad to the
> end of the required length, so (for just a single audio file), something
> like:
>
> (some kind of silence-generator here)[delay0];[in0]atrim=start=1:end=3,apad
> [end0];[delay0][end0]concat=n=2,v=0,a=1[final0]
>
> I can't seem to figure out how to make the concat work, though. No matter
> what technique I use to generate the silence (or non-silence, I've tried
> using sine and anoisesrc), I am getting an "invalid argument". I've tried
> playing around with the ffmpeg exe on the command line, but still can't make
> heads or tails of concat. What am I missing? Or is there a better way to do
> what I am describing?
>

Yes, see adelay filter.


More information about the Libav-user mailing list