FFmpeg修剪精度低 [英] FFmpeg low trim accuracy
问题描述
因此,我试图将1分29秒的视频切成30秒的片段.预期输出为30sec,30sec,29sec.结果是35sec,29sec,23sec.
So, I'm trying to cut a 1 minute 29 seconds video into clips of 30 seconds each. The expected output is 30sec,30sec,29sec. The result is 35sec,29sec,23sec.
这是我的代码-
ArrayList<String> commandList = new ArrayList<>();
commandList.add("-ss");
commandList.add("00:00:00");
commandList.add("-i");
commandList.add(videoPath);
commandList.add("-c");
commandList.add("copy");
commandList.add("-f");
commandList.add("segment");
commandList.add("-segment_time");
commandList.add("00:00:30");
commandList.add(TEST.getAbsolutePath());
String[] command = commandList.toArray(new String[commandList.size()]);
execFFmpegBinary(command);
知道我在做什么错吗?我在某处读到,如果在特定位置不存在关键帧,它将试图找到最接近的关键帧的位置.
Any idea what I'm doing wrong? I read somewhere that if at a particular position a keyframe doesn't exists it seeks to position of the nearest keyframe.
任何解决方案或指南都会对我有所帮助.预先谢谢你.
Any solution or guidance will help me. Thank you in advance.
推荐答案
FFmpeg将在关键帧上开始分段.使用-编解码器复制
时,没有转码,因此它必须使用现有的关键帧.30秒没有关键帧,因此它会在下一个剪切.
FFmpeg will start segments on keyframes. When using -codec copy
there is no transcode, so It must use the existing keyframes. There is no keyframe at 30s, so it cuts at the next one.
这篇关于FFmpeg修剪精度低的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!