wangyunpeng hace 3 semanas
padre
commit
766f166009

+ 1 - 0
src/main/java/com/tzld/ffmpeg/model/param/CommandParam.java

@@ -7,6 +7,7 @@ import lombok.Setter;
 @Setter
 public class CommandParam {
     private String ffmpegCommand;
+    private String inputFile;
     private String outputFile;
     // video audio image text unknown
     private String outputType;

+ 5 - 1
src/main/java/com/tzld/ffmpeg/service/impl/FFmpegServiceImpl.java

@@ -595,6 +595,10 @@ public class FFmpegServiceImpl implements FFmpegService {
         List<String> allLocalFilePathList = new ArrayList<>();
 
         try {
+            String inputFile = FFmpegUtil.pathCreate("./datalog/ffmpeg/command/input/" + param.getOutputFile());
+            allLocalFilePathList.add(inputFile);
+            downloadFile(CdnUtil.getOssHttpUrl(param.getInputFile()), inputFile);
+            ffmpegCommand = ffmpegCommand.replace(param.getInputFile(), inputFile);
             String outputFile = FFmpegUtil.pathCreate("./datalog/ffmpeg/command/result/" + param.getOutputFile());
             allLocalFilePathList.add(outputFile);
             ffmpegCommand = ffmpegCommand.replace(param.getOutputFile(), outputFile);
@@ -624,7 +628,7 @@ public class FFmpegServiceImpl implements FFmpegService {
                 AliOssFileTool.saveInPublic(EnumPublicBuckets.PUBBUCKET.getBucketName(), ossKey, Files.newInputStream(Paths.get(outputFile)), "text/plain");
                 return CdnUtil.getOssHttpUrl(ossKey);
             }
-        } catch (IOException e) {
+        } catch (Exception e) {
             throw new RuntimeException(e);
         } finally {
             for (String s : allLocalFilePathList) {