在这个问题之后,我决定使用ffmpeg来裁剪MP3.在另一个问题上,我发现了这种做法:
ffmpeg -t 30 -acodec copy -i inputfile.mp3 outputfile.mp3
Run Code Online (Sandbox Code Playgroud)
问题是我不想裁剪前30秒,我想从x到x + n裁剪,比如30s到100s.我该怎么做呢?
我正在为ffmpeg读这个人,但这并不是很简单,特别是因为我刚刚发现了ffmpeg并且我不熟悉音频/视频编辑软件,所以任何指针都会受到赞赏.
Mic*_*sen 63
看一下-t和-ss参数.他们应该做你想做的事.
-t持续时间
将转码/捕获的视频序列限制为以秒为单位指定的持续时间.hh:mm:也支持ss [.xxx]语法.
- 位置'
在几秒钟内寻找给定的时间位置.hh:mm:也支持ss [.xxx]语法.
例如,ffmpeg -ss 30 -t 70 -i inputfile.mp3 -acodec copy outputfile.mp3应该为你提到的范围(30s-100s)做诀窍.
Pau*_*rez 26
To expand a bit on Michael Madsens' Answer:
I've found either of the following satisfactory for trimming my audio files:
ffmpeg -ss <start position>-t<duration> -i inputfile -c:a copy outputfileffmpeg -ss <start position>-i inputfile -t<duration> -c:a copy outputfileNote: -acodec is an alias for codec:a which can be specified also as c:a
As specified in the Main Options FFMPEG Documentation
-t duration (input/output)
-ss position (input/output)
duration并position遵循持续时间语法:
[-][HH:]MM:SS[.m...]或者[-]S+[.m...][s|ms|us]旁注:关于如何使用 FFMPEG 检测静音间隔的答案也可能令人感兴趣。
请注意,在大多数格式中不可能精确查找,因此 ffmpeg 将在位置之前查找最近的查找点。当转码和 -accurate_seek 启用(默认)时,搜索点和位置之间的额外段将被解码并丢弃。当进行流复制或使用-noaccurate_seek时,它将被保留。
我对以下文件做了一些测试:
Input #0, mp3, from 'test16s.mp3':
Duration: 00:00:16.20, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Run Code Online (Sandbox Code Playgroud)
将 Audacity 中的输出与原始输出进行比较,得到以下结果:
ffmpeg -ss 3 -t 5 -i test16s.mp3 -c:a copy out.mp3
ffmpeg -ss 3 -i test16s.mp3 -t 5 -c:a copy out.mp3
ffmpeg -i test16s.mp3 -ss 3 -t 5 -c:a copy out.mp3
ffmpeg -t 5 -i test16s.mp3 -ss 3 -c:a copy out.mp3
在尝试查看查找跳转时,我使用以下方法发现了有趣的结果:
ffmpeg -ss <秒> -i test16s.mp3 -t 5 -c:a copy out.mp3
ffmpeg -ss <秒> -t 5 -i test16s.mp3 -c:a copy out.mp3
结论是,使用Stream Copy时,我的特定文件(音频:mp3、44100 Hz、立体声、fltp、128 kb/s)中的最小搜索分辨率似乎是:
| 归档时间: |
|
| 查看次数: |
20650 次 |
| 最近记录: |