Browse Source

相机文件修改权限

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

+ 7 - 6
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -172,7 +172,9 @@ public class CameraUtil {
         Process process = null;
         ProcessBuilder builder = null;
         List<String> command = null;
-
+        String substr = fromVideoFileList.get(0).substring(0, fromVideoFileList.get(0).lastIndexOf("/"));
+        log.info("substr:{}", substr);
+        Runtime.getRuntime().exec("chmod 777 " + substr);
         for (int i = 0; i < fromVideoFileList.size(); i++) {
             String fromVideoFile = fromVideoFileList.get(i);
             command = new ArrayList<String>();
@@ -186,12 +188,11 @@ public class CameraUtil {
             command.add("h264_mp4toannexb");
             command.add("-f");
             command.add("mpegts");
-            fromVideoFile = fromVideoFile.substring(fromVideoFile.lastIndexOf("/") + 1, fromVideoFile.length());
-            String n = flvPath + fromVideoFile.substring(0,
-                    fromVideoFile.lastIndexOf("."));
-            command.add(n + ".ts");
+            command.add(fromVideoFile.substring(0,
+                    fromVideoFile.lastIndexOf(".")) + ".ts");
             builder = new ProcessBuilder(command);
-            voidTS.add(n + ".ts");
+            voidTS.add(fromVideoFile.substring(0,
+                    fromVideoFile.lastIndexOf(".")) + ".ts");
             try {
                 process = builder.start();
                 InputStream errorStream = process