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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Chris Hennes

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?


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Using libav to insert silence at the beginning of an audio clip

Paul B Mahol
On 3/21/17, Chris Hennes <[hidden email]> 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.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Using libav to insert silence at the beginning of an audio clip

Chris Hennes
I started with adelay=1000|1000,atrim... and expected that to give me one second of silence  (for a stereo track), but it did not. I take it that it should have, so I should go back to debugging that? I gave up on it when I couldn't make sense of the output.

From: Libav-user <[hidden email]> on behalf of Paul B Mahol <[hidden email]>
Sent: Tuesday, March 21, 2017 10:53:15 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.
Subject: Re: [Libav-user] Using libav to insert silence at the beginning of an audio clip
 
On 3/21/17, Chris Hennes <[hidden email]> 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.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Using libav to insert silence at the beginning of an audio clip

Paul B Mahol
On 3/21/17, Chris Hennes <[hidden email]> wrote:
> I started with adelay=1000|1000,atrim... and expected that to give me one
> second of silence  (for a stereo track), but it did not. I take it that it
> should have, so I should go back to debugging that? I gave up on it when I
> couldn't make sense of the output.

That should give 1 second of silence at start of audio.

> ________________________________
> From: Libav-user <[hidden email]> on behalf of Paul B Mahol
> <[hidden email]>
> Sent: Tuesday, March 21, 2017 10:53:15 AM
> To: This list is about using libavcodec, libavformat, libavutil, libavdevice
> and libavfilter.
> Subject: Re: [Libav-user] Using libav to insert silence at the beginning of
> an audio clip
>
> On 3/21/17, Chris Hennes <[hidden email]> 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.
> _______________________________________________
> Libav-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/libav-user
>
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user