Open wuxinggege008 opened 1 year ago
相关日志 2022-08-19 18:21:55.862 I/TAG_FFMPEG: Metadata: 2022-08-19 18:21:55.862 I/TAG_FFMPEG: creation_time : 2022-08-19 18:21:55.862 I/TAG_FFMPEG: 2022-08-18T02:19:08.000000Z 2022-08-19 18:21:55.862 I/TAG_FFMPEG: 2022-08-19 18:21:55.862 I/TAG_FFMPEG: handler_name : 2022-08-19 18:21:55.862 I/TAG_FFMPEG: VideoHandle 2022-08-19 18:21:55.862 I/TAG_FFMPEG: 2022-08-19 18:21:55.862 D/TAG_FFMPEG: Successfully opened the file. 2022-08-19 18:21:55.862 D/TAG_FFMPEG: Parsing a group of options: output url 00:00:00.7. 2022-08-19 18:21:55.862 D/TAG_FFMPEG: Successfully parsed a group of options. 2022-08-19 18:21:55.862 D/TAG_FFMPEG: Opening an output file: 00:00:00.7. 2022-08-19 18:21:55.862 E/TAG_FFMPEG: Unable to find a suitable output format for '00:00:00.7' 2022-08-19 18:21:55.862 E/TAG_FFMPEG: 00:00:00.7: Invalid argument 2022-08-19 18:21:55.862 D/TAG_FFMPEG: Statistics: 453336 bytes read, 3 seeks 2022-08-19 18:21:55.863 A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4a0 in tid 11258 (RxCachedThreadS), pid 11105
我也遇到了同样场景,经过尝试貌似解决了,目前没有遇到抛错了;首先得依赖完整包,然后构建命令: new RxFFmpegCommandList() .append("-ss") .append(CommUtils.videoTimeCut(start)) .append("-to") .append(CommUtils.videoTimeCut(end)) .append("-accurate_seek") .append("-i") .append(info.path) .append("-c:v") .append("libx264") .append("-avoid_negative_ts") .append("1") .append(file.getAbsolutePath())
获取裁剪时间:
public static String videoTimeCut(long time) {
final int ms = (int) (time % 1000);
final int t = (int) (time / 1000);
final int s = t % 60;
final int m = t / 60 % 60;
final int h = t / 3600;
return new Formatter(new StringBuilder(), Locale.getDefault()).format("%02d:%02d:%02d.%03d", h, m, s, ms).toString();
}
命令行:-ss 00:00:00.7 -t 00:01:03.4 -accurate_seek -i input.mp4 -codec copy -avoid_negative_ts 1 output_clip.mp4