wangyunpeng 2 weeks ago
parent
commit
50d4cf6916
1 changed files with 10 additions and 10 deletions
  1. 10 10
      core/src/main/java/com/tzld/supply/job/VideoGenerateJob.java

+ 10 - 10
core/src/main/java/com/tzld/supply/job/VideoGenerateJob.java

@@ -168,11 +168,11 @@ public class VideoGenerateJob {
                 // 现仅一种效果,后更改为多种效果随机
                 String outputVideoName = String.format("%s_%d.mp4", produceVideo.getContentId(), System.currentTimeMillis());
                 String command = String.format("ffmpeg -loop 1 -i %s -t 3 -r 25 -filter_complex " +
-                        "\"[0:v]scale=720:1280:force_original_aspect_ratio=increase,crop=720:1280,gblur=sigma=5[bg];" +
-                        "[0:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2:color=black@0[fg];" +
-                        "[fg]zoompan=z='min(1.00+0.000266*on,1.02)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=720x1280[fg_anim];" +
-                        "[bg][fg_anim]overlay=0:0:format=auto\" " +
-                        "-c:v libx264 -pix_fmt yuv420p -movflags +faststart \"%s\"",
+                                "\"[0:v]scale=720:1280:force_original_aspect_ratio=increase,crop=720:1280,gblur=sigma=5[bg];" +
+                                "[0:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2:color=black@0[fg];" +
+                                "[fg]zoompan=z='min(1.00+0.000266*on,1.02)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=720x1280[fg_anim];" +
+                                "[bg][fg_anim]overlay=0:0:format=auto\" " +
+                                "-c:v libx264 -pix_fmt yuv420p -movflags +faststart \"%s\"",
                         CdnUtil.getOssHttpUrl(image.getOssKey()), outputVideoName);
                 CommandParam commandParam = CommandParam.builder()
                         .ffmpegCommand(command)
@@ -299,7 +299,7 @@ public class VideoGenerateJob {
         }
         for (ProduceVideo produceVideo : produceList) {
             // 检查是否存在素材
-             List<ProduceVideoMaterial> materialList = getVideoMaterialList(produceVideo);
+            List<ProduceVideoMaterial> materialList = getVideoMaterialList(produceVideo);
             if (materialList.size() < 10) {
                 continue;
             }
@@ -336,10 +336,10 @@ public class VideoGenerateJob {
             String commandResponseData = ffmpegApiService.command(commandParam);
             String fileName = String.format("supply/video/%s", videoName);
             String finalVideoUrl = AliOssFileTool.downloadAndSaveInOSS(fileName, commandResponseData, "video/mp4");
-             // 更新视频地址
-             produceVideo.setUrl(finalVideoUrl);
-             produceVideo.setStatus(ProduceVideoStatusEnum.PASSED.getCode());
-             produceVideoMapper.updateByPrimaryKeySelective(produceVideo);
+            // 更新视频地址
+            produceVideo.setUrl(finalVideoUrl);
+            produceVideo.setStatus(ProduceVideoStatusEnum.PASSED.getCode());
+            produceVideoMapper.updateByPrimaryKeySelective(produceVideo);
         }
         return ReturnT.SUCCESS;
     }