Commit 21d28f26b2442fd5cd4cbeb0b91bfa4e10ab226a
1 parent
88153af0
优化日志
Showing
2 changed files
with
12 additions
and
9 deletions
src/main/java/top/panll/assist/service/FFmpegExecUtils.java
| @@ -78,6 +78,7 @@ public class FFmpegExecUtils implements InitializingBean{ | @@ -78,6 +78,7 @@ public class FFmpegExecUtils implements InitializingBean{ | ||
| 78 | 78 | ||
| 79 | @Async | 79 | @Async |
| 80 | public void mergeOrCutFile(List<File> fils, File dest, String destFileName, VideoHandEndCallBack callBack){ | 80 | public void mergeOrCutFile(List<File> fils, File dest, String destFileName, VideoHandEndCallBack callBack){ |
| 81 | + | ||
| 81 | if (fils == null || fils.size() == 0 || ffmpeg == null || ffprobe == null || dest== null || !dest.exists()){ | 82 | if (fils == null || fils.size() == 0 || ffmpeg == null || ffprobe == null || dest== null || !dest.exists()){ |
| 82 | callBack.run("error", 0.0, null); | 83 | callBack.run("error", 0.0, null); |
| 83 | return; | 84 | return; |
| @@ -127,15 +128,15 @@ public class FFmpegExecUtils implements InitializingBean{ | @@ -127,15 +128,15 @@ public class FFmpegExecUtils implements InitializingBean{ | ||
| 127 | double percentage = progress.out_time_ns / duration_ns; | 128 | double percentage = progress.out_time_ns / duration_ns; |
| 128 | 129 | ||
| 129 | // Print out interesting information about the progress | 130 | // Print out interesting information about the progress |
| 130 | - System.out.println(String.format( | ||
| 131 | - "[%.0f%%] status:%s frame:%d time:%s ms fps:%.0f speed:%.2fx", | ||
| 132 | - percentage * 100, | ||
| 133 | - progress.status, | ||
| 134 | - progress.frame, | ||
| 135 | - FFmpegUtils.toTimecode(progress.out_time_ns, TimeUnit.NANOSECONDS), | ||
| 136 | - progress.fps.doubleValue(), | ||
| 137 | - progress.speed | ||
| 138 | - )); | 131 | +// System.out.println(String.format( |
| 132 | +// "[%.0f%%] status:%s frame:%d time:%s ms fps:%.0f speed:%.2fx", | ||
| 133 | +// percentage * 100, | ||
| 134 | +// progress.status, | ||
| 135 | +// progress.frame, | ||
| 136 | +// FFmpegUtils.toTimecode(progress.out_time_ns, TimeUnit.NANOSECONDS), | ||
| 137 | +// progress.fps.doubleValue(), | ||
| 138 | +// progress.speed | ||
| 139 | +// )); | ||
| 139 | 140 | ||
| 140 | if (progress.status.equals(Progress.Status.END)){ | 141 | if (progress.status.equals(Progress.Status.END)){ |
| 141 | callBack.run(progress.status.name(), percentage, recordFileResultPath); | 142 | callBack.run(progress.status.name(), percentage, recordFileResultPath); |
src/main/java/top/panll/assist/service/VideoFileService.java
| @@ -338,6 +338,7 @@ public class VideoFileService { | @@ -338,6 +338,7 @@ public class VideoFileService { | ||
| 338 | return null; | 338 | return null; |
| 339 | } | 339 | } |
| 340 | String taskId = DigestUtils.md5DigestAsHex(String.valueOf(System.currentTimeMillis()).getBytes()); | 340 | String taskId = DigestUtils.md5DigestAsHex(String.valueOf(System.currentTimeMillis()).getBytes()); |
| 341 | + logger.info("[录像合并] 开始合并,APP:{}, STREAM: {}, 任务ID:{}", app, stream, taskId); | ||
| 341 | String destDir = "recordTemp" + File.separator + taskId + File.separator + app; | 342 | String destDir = "recordTemp" + File.separator + taskId + File.separator + app; |
| 342 | File recordFile = new File(new File(userSettings.getRecord()).getParentFile().getAbsolutePath() + File.separator + destDir ); | 343 | File recordFile = new File(new File(userSettings.getRecord()).getParentFile().getAbsolutePath() + File.separator + destDir ); |
| 343 | if (!recordFile.exists()) recordFile.mkdirs(); | 344 | if (!recordFile.exists()) recordFile.mkdirs(); |
| @@ -374,6 +375,7 @@ public class VideoFileService { | @@ -374,6 +375,7 @@ public class VideoFileService { | ||
| 374 | mergeOrCutTaskInfo.setPlayFile(remoteHost + "/" + relativize); | 375 | mergeOrCutTaskInfo.setPlayFile(remoteHost + "/" + relativize); |
| 375 | } | 376 | } |
| 376 | redisUtil.convertAndSend("topic_mergeorcut_end", mergeOrCutTaskInfo); | 377 | redisUtil.convertAndSend("topic_mergeorcut_end", mergeOrCutTaskInfo); |
| 378 | + logger.info("[录像合并] 合并完成,APP:{}, STREAM: {}, 任务ID:{}", app, stream, taskId); | ||
| 377 | }else { | 379 | }else { |
| 378 | mergeOrCutTaskInfo.setPercentage(percentage + ""); | 380 | mergeOrCutTaskInfo.setPercentage(percentage + ""); |
| 379 | redisUtil.convertAndSend("topic_mergeorcut_continue", mergeOrCutTaskInfo); | 381 | redisUtil.convertAndSend("topic_mergeorcut_continue", mergeOrCutTaskInfo); |