我建议FFMPEG not "cutting" as expected将视频分成块,格式如下:
00:00:00 - 00:00:01
00:00:01 - 00:00:02
00:00:02 - 00:00:03
00:00:03 - 00:00:04
00:00:04 - 00:00:05
下面是我使用的命令:
String[] cmd1 = new String []{"-ss", "00:00:00.000", "-i", inputVideoUrl, "-t", "00:00:01.000", "-c:v", "libx264", "-strict", "-2", outputPath};
String[] cmd2 = new String []{"-ss", "00:00:01.000", "-i", inputVideoUrl, "-t", "00:00:02.000", "-c:v", "libx264", "-strict", "-2", outputPath};
String[] cmd3 = new String []{"-ss", "00:00:02.000", "-i", inputVideoUrl, "-t", "00:00:03.000", "-c:v", "libx264", "-strict", "-2", outputPath};
String[] cmd4 = new String []{"-ss", "00:00:03.000", "-i", inputVideoUrl, "-t", "00:00:04.000", "-c:v", "libx264", "-strict", "-2", outputPath};
String[] cmd5 = new String []{"-ss", "00:00:04.000", "-i", inputVideoUrl, "-t", "00:00:05.000", "-c:v", "libx264", "-strict", "-2", outputPath};我使用的是这个库:https://github.com/teanersener/mobile-ffmpeg
implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.2.2.LTS'当我执行的时候,我会一直得到从视频开头开始的持续时间。请建议我做错了什么,我搜索并尝试更改命令,但都不起作用。
00:00:00 - 00:00:01
00:00:00 - 00:00:02
00:00:00 - 00:00:03
00:00:00 - 00:00:04
00:00:00 - 00:00:05
让我分享另一个例子来解释我的要求: inputVideoUrl包含任何长度的视频(例如:5分钟)我想将它的用户选择的部分(例如第一个1分钟)剪切为5个分割视频的形式。
拆分1: 00秒-12.0秒
split 2: 12.1秒-24.0秒
拆分3: 24.1秒-36.0秒
split 4: 36.1秒-48.0秒
split 5: 48.1秒-60.0秒
稍后,我将把这些分割的视频提供给播放器播放列表。
发布于 2020-12-23 04:09:05
使用段复用器
您可以在segment muxer中使用一条命令执行所有操作
ffmpeg -i input -c:v libx264 -c:a aac -f segment -segment_time 1 -force_key_frames "expr:gte(t,n_forced*1)" -reset_timestamps 1 output_%03d.mp4expr:gte(t,n_forced*1)中的数值应等于-segment_time值(在本例中为1 )。
https://stackoverflow.com/questions/65403348
复制相似问题