|
@@ -47,9 +47,14 @@ public class CameraUtil {
|
|
|
private static String transcribeFilePath;
|
|
|
private static String webUrl;
|
|
|
private static String bakUrl;
|
|
|
+ private static CmdCameraUtil cUtil;
|
|
|
|
|
|
@Autowired
|
|
|
private CaneraConfig caneraConfig;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CmdCameraUtil cmdCameraUtil;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SysDictDataMapper dictDataMapper;
|
|
|
@Resource
|
|
@@ -74,7 +79,15 @@ public class CameraUtil {
|
|
|
}
|
|
|
new Thread(() -> {
|
|
|
try {
|
|
|
- myConvetor(fromVideoFileList, NewfilePath, uuid);
|
|
|
+ Map<String, String> map = myConvetor(fromVideoFileList, NewfilePath, uuid);
|
|
|
+ if (!ObjectUtils.isEmpty(map)) {
|
|
|
+ cUtil.cmd(map.get("cmd"));
|
|
|
+ //删除生成的ts文件
|
|
|
+ File file1 = new File(map.get("path"));
|
|
|
+ if (file1.exists()) {
|
|
|
+ file1.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
log.error(e.getMessage());
|
|
|
e.printStackTrace();
|
|
@@ -239,9 +252,9 @@ public class CameraUtil {
|
|
|
* @param newfilePath 生产新的视频文件路径
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public static void myConvetor(List<String> fromVideoFileList,
|
|
|
- String newfilePath,
|
|
|
- String uuid) throws IOException {
|
|
|
+ public static Map<String, String> myConvetor(List<String> fromVideoFileList,
|
|
|
+ String newfilePath,
|
|
|
+ String uuid) throws IOException {
|
|
|
/*
|
|
|
* for f in *.flv; do echo "file '$f'" >> mylist.txt; done
|
|
|
ffmpeg -f concat -i mylist.txt -c copy output.flv
|
|
@@ -287,7 +300,7 @@ public class CameraUtil {
|
|
|
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
|
|
|
|
|
|
try {
|
|
|
- String commit1 = ffmpegPath + " -f concat -safe 0 -i " + substring + " -c copy " + newfilePath;
|
|
|
+ String commit1 = ffmpegPath + " -f concat -safe 0 -i " + pathStr + "/" + substring + " -c copy " + newfilePath;
|
|
|
|
|
|
log.info("合并视频命令:{}", commit1);
|
|
|
List<String> commands = new ArrayList<>();
|
|
@@ -298,8 +311,9 @@ public class CameraUtil {
|
|
|
commands.add("cd " + pathStr);
|
|
|
// 合并成一个临时文件
|
|
|
commands.add(commit);
|
|
|
+
|
|
|
// 临时文件转化为 flv
|
|
|
- commands.add(commit1);
|
|
|
+// commands.add(commit1);
|
|
|
log.info("录像视频命令:{}", commands);
|
|
|
for (String line : commands) {
|
|
|
log.info("命令:{}", line);
|
|
@@ -312,13 +326,12 @@ public class CameraUtil {
|
|
|
log.info("*****:{}", rspLine);
|
|
|
}
|
|
|
proc.waitFor();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("cmd", commit1);
|
|
|
+ map.put("path", pathStr + "/" + substring);
|
|
|
+ return map;
|
|
|
|
|
|
|
|
|
- //删除生成的ts文件
|
|
|
- File file1 = new File(pathStr + "/" + substring);
|
|
|
- if (file1.exists()) {
|
|
|
- file1.delete();
|
|
|
- }
|
|
|
} catch (InterruptedException e) {
|
|
|
log.error(e.getMessage());
|
|
|
e.printStackTrace();
|
|
@@ -327,6 +340,7 @@ public class CameraUtil {
|
|
|
out.close();
|
|
|
proc.destroy();
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -338,6 +352,7 @@ public class CameraUtil {
|
|
|
transcribeFilePath = caneraConfig.getTranscribeFilePath();
|
|
|
webUrl = caneraConfig.getWebUrl();
|
|
|
bakUrl = caneraConfig.getBakUrl();
|
|
|
+ cUtil = cmdCameraUtil;
|
|
|
}
|
|
|
|
|
|
/**
|