Переглянути джерело

查询回放视频根据报警ID

gao.qiang 1 рік тому
батько
коміт
1bbd419eb2

+ 2 - 35
vehicle-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -718,41 +718,8 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             public String call() throws Exception {
                 // 执行网络请求...
                 log.info(ffmpegPath + " -re -i /opt/streams/file/" + code + ".mp4  -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/" + code);
-                try {
-                    // 创建ProcessBuilder对象,设置ffmpeg命令及参数
-                    ProcessBuilder pb = new ProcessBuilder("/usr/local/ffmpeg/bin/ffmpeg", "-re", "-i", "/tmp/file/"+code+".mp4", "-c:v", "copy", "-c:a", "copy", "-f", "rtsp", "rtsp://124.70.58.209:8554/live/44");
-
-                    // 设置工作目录,如果需要的话
-                    pb.directory(new File("/usr/local/ffmpeg/bin/ffmpeg"));
-                    Map<String, String> environment = pb.environment();
-                    environment.put("LD_LIBRARY_PATH", "/usr/local/ffmpeg/lib");
-
-                    // 启动进程
-                    Process process = pb.start();
-
-                    // 等待进程执行完成
-                    int exitCode = process.waitFor();
-
-                    // 打印ffmpeg命令的输出信息
-                    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
-                    String line;
-                    while ((line = reader.readLine()) != null) {
-                        log.info("line----"+line);
-                    }
-
-                    // 打印ffmpeg命令的错误信息
-                    BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
-                    String errorLine;
-                    while ((errorLine = errorReader.readLine()) != null) {
-                        log.info("errorLine----"+errorLine);
-                    }
-
-                    // 打印ffmpeg命令的退出码
-                    System.out.println("Exit Code: " + exitCode);
-                } catch (IOException | InterruptedException e) {
-                    log.info("e----"+e.getMessage());
-                    e.printStackTrace();
-                }                return "Response";
+                cmdCameraUtil.cmd(ffmpegPath + " -re -i /opt/streams/file/" + code + ".mp4  -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/" + code);
+                return "Response";
             }
         };