|
|
@@ -17,13 +17,13 @@ import java.util.UUID;
|
|
|
* @date 2023-05-11 09:46:28
|
|
|
*/
|
|
|
public class ConvertTask implements Runnable {
|
|
|
- private final String videoId;
|
|
|
+ private final String videoFileId;
|
|
|
private final String absolutePath;
|
|
|
private final String endpoint;
|
|
|
private final VideoUrlMapper videoUrlMapper;
|
|
|
|
|
|
- public ConvertTask(String videoId, String absolutePath, String endpoint, VideoUrlMapper videoUrlMapper) {
|
|
|
- this.videoId = videoId;
|
|
|
+ public ConvertTask(String videoFileId, String absolutePath, String endpoint, VideoUrlMapper videoUrlMapper) {
|
|
|
+ this.videoFileId = videoFileId;
|
|
|
this.absolutePath = absolutePath;
|
|
|
this.endpoint = endpoint;
|
|
|
this.videoUrlMapper = videoUrlMapper;
|
|
|
@@ -34,7 +34,7 @@ public class ConvertTask implements Runnable {
|
|
|
String filename = String.format("%s.mp4", UUID.randomUUID().toString().replace("-", ""));
|
|
|
String destPath = String.format("/opt/tmp/tomcat/%s", filename);
|
|
|
FFmpegWrapper.formatCovert(absolutePath, destPath);
|
|
|
- String objectName = String.format("video/playback/%s/%s", videoId, filename);
|
|
|
+ String objectName = String.format("video/playback/%s/%s", videoFileId, filename);
|
|
|
try {
|
|
|
String url = String.format("%s/%s", endpoint, objectName);
|
|
|
File destFile = new File(destPath);
|
|
|
@@ -46,7 +46,7 @@ public class ConvertTask implements Runnable {
|
|
|
int height = (int) videoProps.getCodedHeight();
|
|
|
|
|
|
MediaResolution mediaResolution = MediaQuality.getQuality(width, height);
|
|
|
- VideoUrl videoUrl = new VideoUrl(videoId, objectName, VideoUrlType.mp4.name(), url, mediaResolution);
|
|
|
+ VideoUrl videoUrl = new VideoUrl(videoFileId, objectName, VideoUrlType.mp4.name(), url, mediaResolution);
|
|
|
videoUrlMapper.save(videoUrl);
|
|
|
destFile.delete();
|
|
|
} catch (Exception e) {
|