Adding silence between words in audio file using ffmpeg

蹲街弑〆低调 提交于 2020-02-07 05:40: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



来源:https://stackoverflow.com/questions/51305770/adding-silence-between-words-in-audio-file-using-ffmpeg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!