提交 9044c8b3 作者: 方治民

feat: 增加 ffmpeg 监测的异常判断

上级 39e45c1a
...@@ -50,8 +50,6 @@ public class UploadProcessServiceImpl implements UploadProcessService { ...@@ -50,8 +50,6 @@ public class UploadProcessServiceImpl implements UploadProcessService {
final Minio minio; final Minio minio;
final EnvConfig env; final EnvConfig env;
Pattern pattern = Pattern.compile("^.*\\.ts$");
@SneakyThrows @SneakyThrows
@Override @Override
public String handle(String object, MultipartFile file) { public String handle(String object, MultipartFile file) {
...@@ -115,9 +113,14 @@ public class UploadProcessServiceImpl implements UploadProcessService { ...@@ -115,9 +113,14 @@ public class UploadProcessServiceImpl implements UploadProcessService {
// 判断是否配置 ffmpeg 环境 // 判断是否配置 ffmpeg 环境
FFmpeg ffmpeg = new FFmpeg(); FFmpeg ffmpeg = new FFmpeg();
FFprobe ffprobe = new FFprobe(); FFprobe ffprobe = new FFprobe();
try {
if (!ffmpeg.isFFmpeg() || !ffprobe.isFFprobe()) { if (!ffmpeg.isFFmpeg() || !ffprobe.isFFprobe()) {
return object; return object;
} }
} catch (Exception e) {
log.warn(e.getMessage());
return object;
}
// 将上传的文件转存一份到本地临时目录 // 将上传的文件转存一份到本地临时目录
Path tempFile = Paths.get(FileUtil.getTmpDirPath(), "T_" + Commons.uuid(), file.getOriginalFilename()); Path tempFile = Paths.get(FileUtil.getTmpDirPath(), "T_" + Commons.uuid(), file.getOriginalFilename());
...@@ -211,6 +214,7 @@ public class UploadProcessServiceImpl implements UploadProcessService { ...@@ -211,6 +214,7 @@ public class UploadProcessServiceImpl implements UploadProcessService {
executor.createJob(builder).run(); executor.createJob(builder).run();
if (Files.exists(tempFile)) { if (Files.exists(tempFile)) {
Pattern pattern = Pattern.compile("^.*\\.ts$");
// 解析 m3u8 文件 // 解析 m3u8 文件
List<String> lines = FileUtil.readLines(tempFile.toString(), StandardCharsets.UTF_8); List<String> lines = FileUtil.readLines(tempFile.toString(), StandardCharsets.UTF_8);
// 获取 ts 切片文件 // 获取 ts 切片文件
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论