|
@@ -63,16 +63,17 @@ public class VideoFileProcessor {
|
|
|
|
|
|
|
|
VideoUrl videoUrl = mediaRepository.findVideoUrl(dupObjectId);
|
|
VideoUrl videoUrl = mediaRepository.findVideoUrl(dupObjectId);
|
|
|
String urlType = videoUrl.getUrlType();
|
|
String urlType = videoUrl.getUrlType();
|
|
|
- String url = objectResult.getUploadFileRet().getUrl();
|
|
|
|
|
String quality = videoUrl.getQuality();
|
|
String quality = videoUrl.getQuality();
|
|
|
int width = videoUrl.getWidth();
|
|
int width = videoUrl.getWidth();
|
|
|
int height = videoUrl.getHeight();
|
|
int height = videoUrl.getHeight();
|
|
|
|
|
|
|
|
- String objectName1 = url.replace("//oss.reghao.cn", "");
|
|
|
|
|
|
|
+ String url = objectResult.getUploadFileRet().getUrl();
|
|
|
|
|
+ String objectName1 = objectNameService.getObjectNameFromUrl(url);
|
|
|
ObjectResult objectResult1 = putObjectService.copyObject(objectName1);
|
|
ObjectResult objectResult1 = putObjectService.copyObject(objectName1);
|
|
|
String objectId1 = objectResult1.getObjectId();
|
|
String objectId1 = objectResult1.getObjectId();
|
|
|
|
|
+ String url1 = objectResult1.getUploadFileRet().getUrl();
|
|
|
|
|
|
|
|
- VideoUrl videoUrl1 = new VideoUrl(objectId, objectId1, urlType, url, quality, width, height);
|
|
|
|
|
|
|
+ VideoUrl videoUrl1 = new VideoUrl(objectId, objectId1, urlType, url1, quality, width, height);
|
|
|
mediaRepository.saveVideoFile(videoFile1, videoUrl1);
|
|
mediaRepository.saveVideoFile(videoFile1, videoUrl1);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -91,6 +92,18 @@ public class VideoFileProcessor {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String videoCodec = mediaProps.getVideoProps().getCodecName();
|
|
|
|
|
+ if (videoCodecs.contains(videoCodec)) {
|
|
|
|
|
+ AudioProps audioProps = mediaProps.getAudioProps();
|
|
|
|
|
+ if (audioProps != null && !audioCodecs.contains(audioProps.getCodecName())) {
|
|
|
|
|
+ log.error("{} 对象的音频非 aac 编码, 暂不处理", objectName);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.error("{} 对象的视频非 h264 编码, 暂不处理", objectName);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
String videoFileId = objectId;
|
|
String videoFileId = objectId;
|
|
|
int width = videoProps.getCodedWidth().intValue();
|
|
int width = videoProps.getCodedWidth().intValue();
|
|
|
int height = videoProps.getCodedHeight().intValue();
|
|
int height = videoProps.getCodedHeight().intValue();
|
|
@@ -98,30 +111,18 @@ public class VideoFileProcessor {
|
|
|
int duration = videoProps.getDuration().intValue();
|
|
int duration = videoProps.getDuration().intValue();
|
|
|
VideoFile videoFile = new VideoFile(videoFileId, horizontal, duration);
|
|
VideoFile videoFile = new VideoFile(videoFileId, horizontal, duration);
|
|
|
|
|
|
|
|
- AudioProps audioProps = mediaProps.getAudioProps();
|
|
|
|
|
- if (audioProps == null) {
|
|
|
|
|
- log.info("{} 的 FFmpeg 音频信息为 null", objectName);
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ MediaResolution mediaResolution = MediaQuality.getQuality(width, height);
|
|
|
|
|
+ String urlType = FileType.getVideoUrlType(absolutePath);
|
|
|
|
|
|
|
|
- String audioCodec = mediaProps.getAudioProps().getCodecName();
|
|
|
|
|
- String videoCodec = mediaProps.getVideoProps().getCodecName();
|
|
|
|
|
- VideoUrl videoUrl = null;
|
|
|
|
|
- if (audioCodecs.contains(audioCodec) && videoCodecs.contains(videoCodec)) {
|
|
|
|
|
- MediaResolution mediaResolution = MediaQuality.getQuality(width, height);
|
|
|
|
|
- String urlType = FileType.getVideoUrlType(absolutePath);
|
|
|
|
|
- String url = objectNameService.getObjectUrl(objectName);
|
|
|
|
|
- videoUrl = new VideoUrl(videoFileId, objectId, urlType, url, mediaResolution);
|
|
|
|
|
- } else {
|
|
|
|
|
- //videoUrl = getConvertedVideoUrl(videoFileId, new File(absolutePath), width, height);
|
|
|
|
|
- log.error("{} 非 h264&aac 编码, 暂不处理", objectName);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String originalObjectName = objectResult.getObjectName();
|
|
|
|
|
+ ObjectResult objectResult1 = putObjectService.copyObject(originalObjectName);
|
|
|
|
|
+ String objectId1 = objectResult1.getObjectId();
|
|
|
|
|
+ String url = objectResult1.getUploadFileRet().getUrl();
|
|
|
|
|
|
|
|
- if (videoUrl != null) {
|
|
|
|
|
- mediaRepository.saveVideoFile(videoFile, videoUrl);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ VideoUrl videoUrl = new VideoUrl(videoFileId, objectId1, urlType, url, mediaResolution);;
|
|
|
|
|
+ mediaRepository.saveVideoFile(videoFile, videoUrl);
|
|
|
|
|
|
|
|
- log.info("添加视频格式转码任务");
|
|
|
|
|
|
|
+ //log.info("添加视频格式转码任务");
|
|
|
//threadPool.submit(new ConvertTask());
|
|
//threadPool.submit(new ConvertTask());
|
|
|
}
|
|
}
|
|
|
|
|
|