feat(可回溯): 视频生成
修改生成命令
This commit is contained in:
+1
-35
@@ -113,7 +113,7 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
bw.flush();
|
||||
bw.close();
|
||||
fw.close();
|
||||
String[] command = {"ts-node", "/opt/review/index.ts"};
|
||||
String[] command = {"ts-node", "/opt/rrvideo/src/cli.ts", "--input traces.json --output video.mp4"};
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
processBuilder.directory(tempDir.toFile());
|
||||
// 在临时目录下执行命令
|
||||
@@ -138,40 +138,6 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
});
|
||||
processThread.start();
|
||||
|
||||
// Continue with other tasks here...
|
||||
|
||||
|
||||
try {
|
||||
processThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String[] video = {"rrvideo", "--input unpack.json --config /opt/review/config.json --output video.mp4"};
|
||||
ProcessBuilder videoBuilder = new ProcessBuilder(video);
|
||||
videoBuilder.directory(tempDir.toFile());
|
||||
Process p2 = videoBuilder.start();
|
||||
|
||||
|
||||
Thread processThread2 = new Thread(() -> {
|
||||
try {
|
||||
// 读取命令输出
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p2.getInputStream()));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
reader.close();
|
||||
// 等待命令执行完成
|
||||
int exitCode = p2.waitFor();
|
||||
|
||||
System.out.println("Command exited with code " + exitCode);
|
||||
} catch (InterruptedException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
processThread2.start();
|
||||
|
||||
File file = new File(tempDir.toFile(), "video.mp4");
|
||||
if (file.exists()) {
|
||||
log.info(String.valueOf(file.length()));
|
||||
|
||||
Reference in New Issue
Block a user