从命令行创建无声 mp3
I am trying to create a silent / empty mp3 file of (x) seconds using the command line. Quite a simple task I thought!
It seems LAME is able to do something like this, but I am unable to find anything that leads to achieving this.
Has anyone been able to do something like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用此命令。
将
更改为指示您需要的静默秒数的数字(例如,60
将创建一分钟)。You can use this command.
Change
<seconds>
to a number indicating the number of seconds of silence you require (for example,60
will create a minute).免责声明:这是一种面向 UNIX 的方法(尽管 sox 是跨平台的,并且也应该只在 Windows 上完成)。
您需要sox - “声音处理程序的[跨平台]瑞士军刀” ”。
这个包装perl脚本,可以帮助您生成任何几秒钟的沉默:http://www. boutell.com/scripts/silence.html
silence.pl
非常短,所以我将其包含在这里,因为它是公共域:然后只是
lame< /代码>它:
Disclaimer: This is a unix-oriented approach (although sox is cross-platform and should get it done on windows only as well).
You'll need sox - "the [cross-platform] Swiss Army knife of sound processing programs".
This wrapper perl script, helps you generate any seconds of silence: http://www.boutell.com/scripts/silence.html
silence.pl
is quite short, so I include it here, since it's public domains:Then just
lame
it:sox -n -r 44100 -c 2silence.wav trim 0.0 3.0
- 这将创建一个 3 秒立体声静音文件。这里n代表空文件处理程序,r是采样率,c是通道数。
然后就让它变得跛脚:
$ lamesilence.wavsilence.mp3
sox -n -r 44100 -c 2 silence.wav trim 0.0 3.0
- this will create a 3sec stereo silence file.Here n for null file handler, r is the sample rate and c is the number of channels.
Then just lame it:
$ lame silence.wav silence.mp3
避免创建 wav 标头的麻烦,让 lame 处理原始文件:
设置 ?=2 给出 11 秒的文件(@ 标准 44KhZ 等...参数)。
注意:这是在 Unix 上测试的;我知道 Windows 上也有 dd 和 lame 。
Avoid the nuisance of creating a wav header, and let lame handle a raw file:
setting ?=2 gives a 11 second file (@ standard 44KhZ, etc... parameters).
Note: this was tested on Unix; I understand there are dd and lame for windows, too.
另一个解决方案是将现有文件的音量设置为零
Another solution is to set volume to zero on existing file