使用ffmpeg在音频文件中的单词之间添加静音 [英] Adding silence between words in audio file using ffmpeg

查看:262
本文介绍了使用ffmpeg在音频文件中的单词之间添加静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要执行的操作是对包含短音频的文件进行concat wav 文件.我可以将它们 concat 合并为一个文件,但是我试图在特定时间设置每个文件.

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.

当前,我可以 concat 文件,但是不能在需要的特定时间放置每个文件.我以为也许我可以在他们之间添加适当的沉默,然后以这种方式解决问题.我是 ffmpeg

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

我有一个文本文件,文件名即 text.txt

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

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

并且我使用此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

推荐答案

您可以使用 aevalsrc 过滤器生成静音音频.然后使用 concat 过滤器将它们全部合并.

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

这是一个简单的例子:

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

对于 aevalsrc 过滤器, aevalsrc = exprs = 0:d = 5 [silence] . exprs 指定输出值. d 表示持续时间(以秒为单位). [silence] 是您的输出标签.该过滤器还支持指定采样率,采样数等.

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在音频文件中的单词之间添加静音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆