FFMPEG 未达到预期 "cutting"

FFMPEG not "cutting" as expected

我正在通过一个简单的 system.process 使用 FFMPEG(来自 java 应用程序)并尝试将视频切成块。我正在尝试将其切成 10 秒的增量。我的 FFMPEG 命令如下所示:

ffmpeg -i SampleVideo.mp4 -ss 00:00:00.00 -t 00:00:10.00 -strict -2 1438458522836/1438458522836_0.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:10.01 -t 00:00:20.00 -strict -2 1438458522836/1438458536306_1.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:20.01 -t 00:00:30.00 -strict -2 1438458522836/1438458546042_2.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:30.01 -t 00:00:40.00 -strict -2 1438458522836/1438458561165_3.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:40.01 -t 00:00:50.00 -strict -2 1438458522836/1438458577187_4.mp4
ffmpeg -i SampleVideo.mp4 -ss 00:00:50.01 -t 00:01:00.00 -strict -2 1438458522836/1438458587935_5.mp4

它们在我看来是正确的,但我的视频不是以 10 秒为增量出现的。他们似乎在随机地点获得 "split"。对我做错了什么有什么想法吗?

供参考:

video 0 == 10 seconds
video 1 == 20 seconds
Video 2 == 30 seconds
Video 3 == 32 seconds
Video 4 == 22 seconds
Video 5 == 12 seconds

如有任何帮助,我们将不胜感激。

FFMPEG documentation 中所述:

-ss position (input/output) When used as an input option (before -i), seeks in this input file to position. Note the in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved.

When used as an output option (before an output filename), decodes but discards input until the timestamps reach position.

position may be either in seconds or in hh:mm:ss[.xxx] form.

所以,你不会得到一个确切的起点,但是由于 -t 当指针到达指定时间时停止 "listening",你不会得到统一的时间,但它们都会结束当你想要的时候。

今天使用以下命令遇到同样的问题:

ffmpeg -ss 00:00:55.25 -i input.mp4 -t 00:00:04.75 -c copy output.mp4

这始终让我的输出持续时间缩短了几秒钟。 在 this explanation 之后,我将命令重新构造为:

ffmpeg -i input.mp4 -ss 00:00:55.25 -to 00:01:00.0 -c copy output.mp4

现在精度范围从 0 到 0.02 秒。