首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Sox裁剪音频文件,单位为毫秒

使用Sox裁剪音频文件,单位为毫秒
EN

Stack Overflow用户
提问于 2012-09-24 17:15:28
回答 3查看 31.9K关注 0票数 17

有没有一种方法可以用SoX修剪文件的结尾,单位是毫秒,我已经尝试过了:

代码语言:javascript
复制
sox tracks\5_7.mp3 ntracks\05_7.mp3 trim 2 2.195

但是,它只显示End position is after expected end of audio,尽管文件实际上有那么长。

所以我试着让这首歌有2.000秒长,而不是2.195秒,而且,我是用600+文件做的,所以需要从命令行来做。

以下是我的警告:

代码语言:javascript
复制
sox WARN mp3: MAD lost sync"(this always happens, means nothing) 
sox WARN trim: Last 1 position(s) not reached (audio shorter than expected)
sox WARN sox: 'tracks\01_1.mp3' balancing clipped 3 samples; decrease volume?

这个音频文件是"00:00:02.19“。

输入到命令行中的行是:

代码语言:javascript
复制
sox -v3 tracks\01_1.mp3 ntracks\01_1.mp3 trim 2 0.19 pause

下面是我的详细开头:

代码语言:javascript
复制
D:\Stuff\Habbo trax maker\trax maker\mp3support>sox -V3 tracks\01_1.mp3 ntracks\
01_1.mp3 trim 2 0.19
sox:      SoX v14.4.0

Input File     : 'tracks\01_1.mp3'
Channels       : 1
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:02.19 = 96755 samples = 164.549 CDDA sectors
File Size      : 17.6k
Bit Rate       : 64.0k
Sample Encoding: MPEG audio (layer I, II or III)

sox INFO sox: Overwriting `ntracks\01_1.mp3'
sox INFO mp3: using MP3 encoding defaults

Output File    : 'ntracks\01_1.mp3'
Channels       : 1
Sample Rate    : 44100
Precision      : 24-bit
Sample Encoding: MPEG audio (layer I, II or III)
Comment        : 'Processed by SoX'

sox INFO sox: effects chain: input        44100Hz  1 channels
sox INFO sox: effects chain: trim         44100Hz  1 channels
sox INFO sox: effects chain: output       44100Hz  1 channels
sox WARN mp3: MAD lost sync
sox WARN trim: Last 1 position(s) not reached (audio shorter than expected).
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-09-24 17:28:13

如果要以毫秒精度进行修剪,请指定它:

代码语言:javascript
复制
sox in.mp3 out.mp3 trim 2 0.195

节省195毫秒,in.mp3out.mp3的偏移量为2秒。

如果您只想要文件的前两秒,请使用trim,如下所示:

代码语言:javascript
复制
sox in.mp3 out.mp3 trim 0 2

如果您想跳过文件的前两秒,请使用trim,如下所示:

代码语言:javascript
复制
sox in.mp3 out.mp3 trim 2

如果要从文件末尾删除195毫秒,请使用 answer。

从手册中摘录:

代码语言:javascript
复制
trim start [length|=end]
   The optional length parameter gives the length of audio to output after the 
   start sample and is thus used to trim off the end of the audio.
   Alternatively, an absolute end location can be given by preceding it with 
   an equals sign. Using a value of 0 for the start parameter will allow trimming
   off the end only.
票数 25
EN

Stack Overflow用户

发布于 2013-01-13 03:41:29

您有没有尝试过像这样使用反向命令:

代码语言:javascript
复制
sox tracks\5_7.mp3 ntracks\05_7.mp3 reverse trim 0.195 reverse

这应该会丢弃文件的最后0.195毫秒(它对我有效)。

票数 10
EN

Stack Overflow用户

发布于 2015-01-20 14:37:44

您应该像这样使用以毫秒为单位进行裁剪

代码语言:javascript
复制
trim 26.26 =32.3245678 

这意味着它将把26.26秒精确到32.3245678秒

这将为您提供准确的结果

使用此=选项时,我们需要提供时间的结束,而不是=之前的持续时间

我希望这能解决你的问题

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12562023

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档