suntianwu 3 gadi atpakaļ
vecāks
revīzija
4262e6638a

+ 4 - 3
src/main/java/com/iden/common/videotool/VideoTool.java

@@ -37,9 +37,9 @@ public class VideoTool {
         String cmd = ffmpegPath +  " -y -i " + videoFilePath + " -r " + framRate + " " + saveTmpDir + "/%08d.jpg";
         String cmd = ffmpegPath +  " -y -i " + videoFilePath + " -r " + framRate + " " + saveTmpDir + "/%08d.jpg";
 
 
         log.info("start fetchAllPic:" + cmd);
         log.info("start fetchAllPic:" + cmd);
-        Runtime.getRuntime().exec(cmd);
+        Process proc = Runtime.getRuntime().exec(cmd);
+        proc.waitFor();
         log.info("fetchAllPic end");
         log.info("fetchAllPic end");
-        Thread.sleep(5000);
         moveFile(beginTime,saveTmpDir,targetDir,framRate);
         moveFile(beginTime,saveTmpDir,targetDir,framRate);
 
 
         return duration;
         return duration;
@@ -84,7 +84,8 @@ public class VideoTool {
                 + " -t " + duration + " -c:v copy -c:a copy " + targetPath;
                 + " -t " + duration + " -c:v copy -c:a copy " + targetPath;
 
 
         log.info("start cutVideo :" + cmd);
         log.info("start cutVideo :" + cmd);
-        Runtime.getRuntime().exec(cmd);
+        Process proc = Runtime.getRuntime().exec(cmd);
+        proc.waitFor();
         log.info("cutVideo end");
         log.info("cutVideo end");
 
 
     }
     }