Jelajahi Sumber

替换合并视频代码

hexiao 1 tahun lalu
induk
melakukan
50652e4362

+ 16 - 3
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -394,7 +394,14 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
 
                 String cmdstr = ffmpegPath + " -i " + fromVideoFileList.get(t) + " -c:v copy " + substring + ".ts";
                 log.info("转换命令:{}", cmdstr);
-                cUtil.cmd(cmdstr);
+
+                executor.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        cUtil.cmd(cmdstr);
+                    }
+                });
+
                 fileTs.add(substring + ".ts");
                 if (t != fromVideoFileList.size() - 1) {
                     sm.append(substring + ".ts|");
@@ -407,9 +414,15 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.flv
         if (fileTs.size() > 0) {
             sm.append("-c copy " + newfilePath);
             log.info("合并命令:{}", sm.toString());
-            cUtil.cmd(sm.toString());
+            executor.submit(new Runnable() {
+                @Override
+                public void run() {
+                    cUtil.cmd(sm.toString());
+                }
+            });
+
         }
-        Thread.sleep(2000L);
+        Thread.sleep(1000L);
         for (String fileT : fileTs) {
             File ft = new File(fileT);
             if (ft.exists()) {