|
@@ -937,38 +937,44 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
public void playbackURLs(List<String> list) {
|
|
|
log.info("--------------->playbackURLs");
|
|
|
CompletableFuture future = CompletableFuture.supplyAsync(() -> {
|
|
|
- for (String code : list) {
|
|
|
-// PlaybackVo playbackVo = new PlaybackVo();
|
|
|
-// playbackVo.setCameraIndexCode(code);
|
|
|
-// // 获取当前时间
|
|
|
-// LocalDateTime currentTime = LocalDateTime.now();
|
|
|
-// // 获取当前时间的前10分钟时间
|
|
|
-// LocalDateTime beforeTenMinutes = currentTime.minusMinutes(10);
|
|
|
-// // 获取当前时间的后10分钟时间
|
|
|
-// LocalDateTime afterTenMinutes = currentTime.plusMinutes(10);
|
|
|
-// // 格式化时间
|
|
|
-// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
-// playbackVo.setBeginTime(beforeTenMinutes.format(formatter));
|
|
|
-// playbackVo.setEndTime(afterTenMinutes.format(formatter));
|
|
|
-// //对象转换json字符串
|
|
|
-// String body = JSONObject.toJSONString(playbackVo);
|
|
|
-// //调用天网接口
|
|
|
-// String previewURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
-// JSONObject outJson = (JSONObject) JSONObject.parse(previewURLs);
|
|
|
-// if ("0".equals(outJson.getString("code"))) {
|
|
|
-// log.info("outJson----->" + outJson);
|
|
|
-// JSONObject data = outJson.getJSONObject("data");
|
|
|
-// String urls = data.getString("url");
|
|
|
-// log.info("--------------->code::" + code);
|
|
|
-
|
|
|
- String streamUrl = "rtsp://124.70.58.209:8554/"+code+"/"+code;;
|
|
|
- String FilePath = "/opt/streams/map/"+code+".mp4";
|
|
|
- Process process = rtspToMP4.StartRecord(ffmpegPath, streamUrl, FilePath);
|
|
|
- log.info("------playbackURLs----->>>>:"+process);
|
|
|
+// for (String code : list) {
|
|
|
+ PlaybackVo playbackVo = new PlaybackVo();
|
|
|
+ playbackVo.setCameraIndexCode("42010001541320000024");
|
|
|
+ // 获取当前时间
|
|
|
+ LocalDateTime currentTime = LocalDateTime.now();
|
|
|
+ // 获取当前时间的前10分钟时间
|
|
|
+ LocalDateTime beforeTenMinutes = currentTime.minusMinutes(10);
|
|
|
+ // 获取当前时间的后10分钟时间
|
|
|
+ LocalDateTime afterTenMinutes = currentTime.plusMinutes(10);
|
|
|
+ // 格式化时间
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
|
|
|
+ playbackVo.setBeginTime(beforeTenMinutes.format(formatter));
|
|
|
+ //现在当前时间:后续需要修改成报警时间的后几分钟
|
|
|
+ playbackVo.setEndTime(currentTime.format(formatter));
|
|
|
+ // jsonBody.put("protocol","rtsp");
|
|
|
+ // jsonBody.put("expand","streamform=rtp");
|
|
|
+ playbackVo.setProtocol("rtsp");
|
|
|
+ playbackVo.setExpand("streamform=rtp");
|
|
|
+ //对象转换json字符串
|
|
|
+ String body = JSONObject.toJSONString(playbackVo);
|
|
|
+ //调用天网接口
|
|
|
+ log.info("body----->" + body);
|
|
|
+// String previewURLs = getPreviewURLs("/api/video/v1/cameras/playbackURLs", body);
|
|
|
+// log.info("previewURLs----->" + previewURLs);
|
|
|
+// JSONObject outJson = (JSONObject) JSONObject.parse(previewURLs);
|
|
|
+// if ("0".equals(outJson.getString("code"))) {
|
|
|
+// log.info("outJson----->" + outJson);
|
|
|
+// JSONObject data = outJson.getJSONObject("data");
|
|
|
+// String urls = data.getString("url");
|
|
|
+// log.info("--------------->urls::" + urls);
|
|
|
+
|
|
|
+ String FilePath = "/opt/streams/map/42010001541320000024.mp4";
|
|
|
+// String FilePath = "/opt/streams/map/01ea43e6676f4e47bd6c5cd9e02aa006.mp4";
|
|
|
+ Process process = rtspToMP4.StartRecord(ffmpegPath, "rtsp://124.70.58.209:8554/42010001541320000024/42010001541320000024", FilePath);
|
|
|
+ log.info("------playbackURLs----->>>>:" + process);
|
|
|
if (null != process) {
|
|
|
- map.put(code, process);
|
|
|
+ map.put("42010001541320000024", process);
|
|
|
}
|
|
|
- }
|
|
|
return 1;
|
|
|
});
|
|
|
future.join();
|