项目中需要把rtsp流保存为视频文件但是用ffmpeg时出线问题
ProcessBuilder processBuilder = new ProcessBuilder();
//定义命令内容
List<String> command = new ArrayList<>();
command.add(ffmpegPath);
command.add("-rtsp_transport");
command.add("tcp");
command.add("-y");
command.add("-i");
command.add(streamUrl);
command.add("-c");
command.add("copy");
command.add("-f");
command.add("mp4");
command.add(FilePath);
processBuilder.command(command);
System.out.println("脚本:" + command.toString());
//将标准输入流和错误输入流合并,通过标准输入流读取信息
processBuilder.redirectErrorStream(true);
try {
//启动进程
Process process = processBuilder.start();
System.out.println("开始时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis())));
//获取输入流
InputStream inputStream = process.getInputStream();
Thread inThread = new Thread(new In(inputStream));
inThread.start();
return process;
} catch (Exception e) {
e.printStackTrace();
}
这个报错
具体怎么改不清楚