Browse Source

相机文件修改权限

hexiao 2 years ago
parent
commit
0d5b2ad47f
1 changed files with 11 additions and 1 deletions
  1. 11 1
      hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

+ 11 - 1
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -182,6 +182,7 @@ public class CameraUtil {
         String substr = fromVideoFileList.get(0).substring(0, fromVideoFileList.get(0).lastIndexOf("/"));
         log.info("substr:{}", substr);
         Runtime.getRuntime().exec("chmod 777 " + substr);
+        // 转化为临时文件 .ts  放入到 voidTS里面
         for (int i = 0; i < fromVideoFileList.size(); i++) {
             String fromVideoFile = fromVideoFileList.get(i);
             File file1 = new File(fromVideoFile);
@@ -232,11 +233,13 @@ public class CameraUtil {
                 log.info("文件不存在:{}", fromVideoFile);
             }
         }
+        log.info("ffmpegPath:{}", ffmpegPath);
         List<String> dos = new ArrayList<>();
         StringBuffer tsPath = new StringBuffer();
         tsPath.append(ffmpegPath);
         tsPath.append(" -i ");
         tsPath.append("concat:");
+        log.info("voidTS:{}", voidTS);
         for (int t = 0; t < voidTS.size(); t++) {
             if (t != voidTS.size() - 1) {
                 tsPath.append(voidTS.get(t) + "|");
@@ -258,7 +261,13 @@ public class CameraUtil {
         pr.getInputStream().close();
         pr.getErrorStream().close();
         try {
-            pr.waitFor();
+            int i = pr.waitFor();
+            System.out.println("********");
+            log.info("********");
+            System.out.println(i);
+            log.info(i + "");
+            log.info("********");
+            System.out.println("********");
         } catch (InterruptedException e) {
             log.error(e.getMessage());
             e.printStackTrace();
@@ -269,6 +278,7 @@ public class CameraUtil {
         for (String filePath : voidTS) {
             File filet = new File(filePath);
             filet.delete();
+            pr.destroy();
         }
     }