FFMPEG不能“剪切".符合预期 [英] FFMPEG not "cutting" as expected

查看:54
本文介绍了FFMPEG不能“剪切".符合预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using FFMPEG (from a java application) via a simple system.process and trying to cut a video into chunks. I am attempting to cut it into 10 second increments. My FFMPEG commands look like:

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秒的增量显示.他们似乎正随机地分裂".关于我在做什么错的任何想法吗?

They look correct to me but my videos are not coming out in 10 second increments. They seem to be getting "split" in random spots. Any ideas on what I am doing wrong?

供参考:

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文档:

-ss位置(输入/输出)当用作输入选项时(在 -i 之前),在此输入文件中查找位置.请注意,在大多数格式中,无法精确搜索,因此ffm​​peg会在位置之前搜索到最接近的搜索点.启用转码和-accurate_seek(默认设置)后,在搜索之间的这一额外段点和位置将被解码并丢弃.在进行流复制或使用-noaccurate_seek时,将保留它.

-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.

位置可以是几秒钟,也可以是 hh:mm:ss [.xxx] 形式.

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

因此,您不会获得确切的起点,但是由于 -t 在指针到达指定时间时停止监听",因此您不会获得统一的时间,但是它们都结束了当你想要的时候.

So, you won't get an exact starting point, but since -t stops "listening" when the pointer hits the specified time, you don't get uniform times, but they all end when you want.

这篇关于FFMPEG不能“剪切".符合预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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