|
@@ -741,32 +741,6 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * RTSP流下载
|
|
|
- */
|
|
|
- public void streamUrlDownload(String url, String code) {
|
|
|
- ExecutorService executor = Executors.newSingleThreadExecutor();
|
|
|
- Callable<String> task = new Callable<String>() {
|
|
|
- @Override
|
|
|
- public String call() throws Exception {
|
|
|
- // 执行网络请求...
|
|
|
- log.info(ffmpegPath + " -loglevel debug -i " + url + " -codec copy /opt/streams/map/" + code+".mp4");
|
|
|
- cmdCameraUtil.cmd(ffmpegPath + " -i " + url + " -codec copy /opt/streams/map/" + code+".mp4"); return "Response";
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- try {
|
|
|
- String result = executor.submit(task).get(1, TimeUnit.SECONDS); // 设置5秒超时时间
|
|
|
- System.out.println("Response: " + result);
|
|
|
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
|
|
|
- // 请求超时处理逻辑
|
|
|
- System.out.println("Request timeout");
|
|
|
- }
|
|
|
-
|
|
|
- executor.shutdown();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public static List<Map<String, Object>> filterRecordList(String channel,
|
|
|
Date startTm,
|
|
|
Date endTm,
|
|
@@ -980,8 +954,12 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
// log.info("outJson----->" + outJson);
|
|
|
// JSONObject data = outJson.getJSONObject("data");
|
|
|
// String urls = data.getString("url");
|
|
|
- log.info("--------------->code::"+code);
|
|
|
- streamUrlDownload("rtsp://124.70.58.209:8554/42010001541320000024/42010001541320000024", code);
|
|
|
+ log.info("--------------->code::" + code);
|
|
|
+ FfmpegUtil recordVideoThread = new FfmpegUtil();
|
|
|
+ recordVideoThread.out_file_path = "/opt/streams/map/"+code+".mp4";
|
|
|
+ recordVideoThread.times_sec = 30L;// 最好设置结束时长 如直接停止程序会造成输出文件的损坏无法正常播放
|
|
|
+ recordVideoThread.is_audio = true;
|
|
|
+ new Thread(recordVideoThread).start();
|
|
|
// }
|
|
|
}
|
|
|
return 1;
|