如何使用 FFmpeg 在几秒钟之间剪切视频?



例如:

startMs = 2.4.   
endMs = 5.4  
I have tried this code:  
String[] complexCommand = {"-i", yourRealPath, "-ss", "" + startMs, "-acodec", "copy", "-vcodec", "copy", "-t", "" + (endMs - startMs), dest.getAbsolutePath()};

但是切割过程发生在全值(整数值(下...从"秒 2"到"秒 5">
有什么方法可以剪切带有"浮点值"的视频吗?
谢谢

你不能使用时间戳吗?像这样:

String startMs = "00:00:02.400";
String endMs  = "00:00:05.400";
Srting totalMs = "00:00:03.000";
String[] complexCommand = {"-i", yourRealPath, "-ss", "" + startMs, "-acodec", "copy", "-vcodec", "copy", "-t", "" + (endMs - startMs), dest.getAbsolutePath()};

请参阅此链接

你可能需要调整一些东西,我现在无法测试它,但这是一个尝试。祝你好运!

最新更新