|
@@ -546,6 +546,12 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
* @return
|
|
|
*/
|
|
|
public static String getRecordUrl(String cameraCode, String channel, Date startTm, Date endTm) {
|
|
|
+ log.info("getRecordUrl--->" + cameraCode + "--" + channel + "--" + startTm + "--" + endTm);
|
|
|
+ Integer count = streamPathCount();
|
|
|
+ log.info("getRecordUrl--count->" + count);
|
|
|
+ if (count>3){
|
|
|
+ return "目前回放视频数已超过带宽限制,请您稍后重试";
|
|
|
+ }
|
|
|
log.info(bakUrl + "/gb28181/api/invite?id=" + cameraCode + "&channel=" + channel + "&startTime=" + startTm.getTime()/1000 + "&endTime=" + endTm.getTime()/1000);
|
|
|
String url = bakUrl + "/gb28181/api/invite?id=" + cameraCode + "&channel=" + channel + "&startTime=" + startTm.getTime()/1000 + "&endTime=" + endTm.getTime()/1000;
|
|
|
try {
|
|
@@ -623,6 +629,43 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static Integer streamPathCount() {
|
|
|
+ int maxRetries = 5;
|
|
|
+ int retryCount = 0;
|
|
|
+ int count=0;
|
|
|
+ boolean success = false;
|
|
|
+ JSONArray streamArray = null;
|
|
|
+ while (!success && retryCount < maxRetries) {
|
|
|
+ try {
|
|
|
+ String data = HttpClientUtil.gets(bakUrl + "/api/summary");
|
|
|
+ log.info("data------------------>" + data);
|
|
|
+ if (StringUtils.isNotEmpty(data)) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ streamArray = jsonObject.getJSONArray("Streams");
|
|
|
+ success = true;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("Exception caught: " + e.getMessage());
|
|
|
+ // 增加重试计数
|
|
|
+ retryCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("---------streamArray-----" + streamArray);
|
|
|
+ if (!ObjectUtils.isEmpty(streamArray)) {
|
|
|
+ for (int i = 0; i < streamArray.size(); i++) {
|
|
|
+ JSONObject subObj = streamArray.getJSONObject(i);
|
|
|
+ String streamPath = subObj.getString("StreamPath");
|
|
|
+ log.info("---------streamPath-----" + streamPath);
|
|
|
+ //判断streamPath中/的个数是否大于等于2
|
|
|
+ if (streamPath.split("/").length >= 2) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 定时任务参数flv文件
|
|
|
* -----------------------------废弃
|