|
@@ -282,9 +282,10 @@ public class CameraUtil {
|
|
sm.append("; do echo \"file '$f'\" >> " + substring + "; done");
|
|
sm.append("; do echo \"file '$f'\" >> " + substring + "; done");
|
|
String commit = sm.toString();
|
|
String commit = sm.toString();
|
|
log.info("合并转化文件的命令:{}", commit);
|
|
log.info("合并转化文件的命令:{}", commit);
|
|
- Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
|
|
|
|
- BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
|
|
|
- PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
|
|
|
|
|
|
+// Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
|
|
|
|
+
|
|
|
|
+// BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
|
|
|
|
+// PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
|
|
|
|
|
|
try {
|
|
try {
|
|
String commit1 = ffmpegPath + " -f concat -safe 0 -i " + substring + " -c copy " + newfilePath;
|
|
String commit1 = ffmpegPath + " -f concat -safe 0 -i " + substring + " -c copy " + newfilePath;
|
|
@@ -299,35 +300,34 @@ public class CameraUtil {
|
|
// 合并成一个临时文件
|
|
// 合并成一个临时文件
|
|
commands.add(commit);
|
|
commands.add(commit);
|
|
// 临时文件转化为 flv
|
|
// 临时文件转化为 flv
|
|
-// commands.add(commit1);
|
|
|
|
|
|
+ commands.add(commit1);
|
|
log.info("录像视频命令:{}", commands);
|
|
log.info("录像视频命令:{}", commands);
|
|
for (String line : commands) {
|
|
for (String line : commands) {
|
|
log.info("命令:{}", line);
|
|
log.info("命令:{}", line);
|
|
- out.println(line);
|
|
|
|
- }
|
|
|
|
- out.println("exit");// 这个命令必须执行,否则in流不结束。
|
|
|
|
- log.info("命令:{}", "exit");
|
|
|
|
- String rspLine = "";
|
|
|
|
- while ((rspLine = in.readLine()) != null) {
|
|
|
|
- log.info("*****:{}", rspLine);
|
|
|
|
|
|
+ Runtime.getRuntime().exec(new String[]{"sh", "-c", line});
|
|
|
|
+// out.println(line);
|
|
}
|
|
}
|
|
- proc.waitFor();
|
|
|
|
|
|
+// out.println("exit");// 这个命令必须执行,否则in流不结束。
|
|
|
|
+// log.info("命令:{}", "exit");
|
|
|
|
+// String rspLine = "";
|
|
|
|
+// while ((rspLine = in.readLine()) != null) {
|
|
|
|
+// log.info("*****:{}", rspLine);
|
|
|
|
+// }
|
|
|
|
+// proc.waitFor();
|
|
|
|
|
|
- log.info("命令:{}", commit1);
|
|
|
|
- Runtime.getRuntime().exec(new String[]{"sh", "-c", commit1});
|
|
|
|
|
|
|
|
//删除生成的ts文件
|
|
//删除生成的ts文件
|
|
File file1 = new File(pathStr + "/" + substring);
|
|
File file1 = new File(pathStr + "/" + substring);
|
|
if (file1.exists()) {
|
|
if (file1.exists()) {
|
|
file1.delete();
|
|
file1.delete();
|
|
}
|
|
}
|
|
- } catch (InterruptedException e) {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
} finally {
|
|
} finally {
|
|
- in.close();
|
|
|
|
- out.close();
|
|
|
|
- proc.destroy();
|
|
|
|
|
|
+// in.close();
|
|
|
|
+// out.close();
|
|
|
|
+// proc.destroy();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|