Adding silence between words in audio file using f

2019-08-21 04:06发布

问题:

What I am trying to do is to concat wav files which contain short audios. I am able to concat them into one file, but I am trying to set each file at a specific time.

Currently, I can concat the files but I can't place each one at the specific time they need to be. I thought maybe I can just add the right amount of silence between them and solve the problem this way. I am new to ffmpeg

I have a text file with the file names i.e. text.txt

file a.wav
file b.wav
file c.wav

and I use this cmd:

ffmpeg -f concat -i text.txt out.mp3

This works, but is there a way to add a specified number of minutes of silence between them?

I tried to put this in the text file, but it didn't work:

file a.wav
inpoint 5
outpoint 10
file b.wav
inpoint 10
outpoint 20
file c.wav
inpoint 20
outpoint 25

回答1:

You can use the aevalsrc filter to generate silence audio. Then use the concat filter to merge them all.

Here is a simple example:

E:\video\tmp>ffmpeg -i a.wav -i b.wav -filter_complex "aevalsrc=exprs=0:d=5[silence], [0:a] [silence] [1:a] concat=n=3:v=0:a=1[outa]" -map [outa] out.mp3

For aevalsrc filter, aevalsrc=exprs=0:d=5[silence]. exprs specifies the output value. d means the duration in seconds. [silence] is your output label. This filter also supports specifying the sample rate, number of samples and so on.

Check this page for detail:

http://www.ffmpeg.org/ffmpeg-filters.html



标签: ffmpeg ffmpy