|
@@ -206,6 +206,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);
|
|
@@ -256,11 +257,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) + "|");
|
|
@@ -275,6 +278,7 @@ public class CameraUtil {
|
|
|
tsPath.append(" -movflags ");
|
|
|
tsPath.append(" +faststart ");
|
|
|
tsPath.append(newfilePath);
|
|
|
+ log.info("执行的命令:{}", tsPath.toString());
|
|
|
Process pr = Runtime.getRuntime().exec(
|
|
|
tsPath.toString());
|
|
|
process.getInputStream();
|
|
@@ -282,7 +286,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();
|
|
@@ -290,10 +300,11 @@ public class CameraUtil {
|
|
|
pr.destroy();
|
|
|
}
|
|
|
//删除生成的ts文件
|
|
|
- for (String filePath : voidTS) {
|
|
|
- File filet = new File(filePath);
|
|
|
- filet.delete();
|
|
|
- }
|
|
|
+// for (String filePath : voidTS) {
|
|
|
+// File filet = new File(filePath);
|
|
|
+// filet.delete();
|
|
|
+// pr.destroy();
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|