Commit ed08c7ef77b3466e8f388fe3ea3f6a94f324fa4e

Authored by 648540858
Committed by GitHub
2 parents 8773864b fe9965bc

Merge pull request #785 from xiaoQQya/wvp-28181-2.0

新增对 H265 编码视频截图的支持
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.common; @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.common;
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4
5 import java.io.Serializable; 5 import java.io.Serializable;
  6 +import java.util.Objects;
6 7
7 @Schema(description = "流信息") 8 @Schema(description = "流信息")
8 public class StreamInfo implements Serializable, Cloneable{ 9 public class StreamInfo implements Serializable, Cloneable{
@@ -168,7 +169,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -168,7 +169,7 @@ public class StreamInfo implements Serializable, Cloneable{
168 } 169 }
169 170
170 public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) { 171 public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
171 - String file = String.format("%s/%s/%s", app, stream, callIdParam); 172 + String file = String.format("%s/%s%s", app, stream, callIdParam);
172 if (port > 0) { 173 if (port > 0) {
173 this.rtmp = new StreamURL("rtmp", host, port, file); 174 this.rtmp = new StreamURL("rtmp", host, port, file);
174 } 175 }
@@ -178,7 +179,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -178,7 +179,7 @@ public class StreamInfo implements Serializable, Cloneable{
178 } 179 }
179 180
180 public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) { 181 public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
181 - String file = String.format("%s/%s/%s", app, stream, callIdParam); 182 + String file = String.format("%s/%s%s", app, stream, callIdParam);
182 if (port > 0) { 183 if (port > 0) {
183 this.rtsp = new StreamURL("rtsp", host, port, file); 184 this.rtsp = new StreamURL("rtsp", host, port, file);
184 } 185 }
@@ -237,6 +238,7 @@ public class StreamInfo implements Serializable, Cloneable{ @@ -237,6 +238,7 @@ public class StreamInfo implements Serializable, Cloneable{
237 } 238 }
238 239
239 public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) { 240 public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
  241 + callIdParam = Objects.equals(callIdParam, "") ? callIdParam : callIdParam.replace("?", "&");
240 String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); 242 String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
241 if (port > 0) { 243 if (port > 0) {
242 this.rtc = new StreamURL("http", host, port, file); 244 this.rtc = new StreamURL("http", host, port, file);
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
@@ -323,9 +323,9 @@ public class ZLMRESTfulUtils { @@ -323,9 +323,9 @@ public class ZLMRESTfulUtils {
323 sendPost(mediaServerItem, "kick_sessions",param, null); 323 sendPost(mediaServerItem, "kick_sessions",param, null);
324 } 324 }
325 325
326 - public void getSnap(MediaServerItem mediaServerItem, String flvUrl, int timeout_sec, int expire_sec, String targetPath, String fileName) { 326 + public void getSnap(MediaServerItem mediaServerItem, String streamUrl, int timeout_sec, int expire_sec, String targetPath, String fileName) {
327 Map<String, Object> param = new HashMap<>(3); 327 Map<String, Object> param = new HashMap<>(3);
328 - param.put("url", flvUrl); 328 + param.put("url", streamUrl);
329 param.put("timeout_sec", timeout_sec); 329 param.put("timeout_sec", timeout_sec);
330 param.put("expire_sec", expire_sec); 330 param.put("expire_sec", expire_sec);
331 sendGetForImg(mediaServerItem, "getSnap", param, targetPath, fileName); 331 sendGetForImg(mediaServerItem, "getSnap", param, targetPath, fileName);
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -547,6 +547,7 @@ public class MediaServerServiceImpl implements IMediaServerService { @@ -547,6 +547,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
547 547
548 Map<String, Object> param = new HashMap<>(); 548 Map<String, Object> param = new HashMap<>();
549 param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline 549 param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline
  550 + param.put("ffmpeg.snap", "%s -rtsp_transport tcp -i %s -y -f mjpeg -t 0.001 %s");
550 param.put("hook.enable","1"); 551 param.put("hook.enable","1");
551 param.put("hook.on_flow_report",""); 552 param.put("hook.on_flow_report","");
552 param.put("hook.on_play",String.format("%s/on_play", hookPrex)); 553 param.put("hook.on_play",String.format("%s/on_play", hookPrex));
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -266,7 +266,7 @@ public class PlayServiceImpl implements IPlayService { @@ -266,7 +266,7 @@ public class PlayServiceImpl implements IPlayService {
266 onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId); 266 onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId);
267 hookEvent.response(mediaServerItemInuse, response); 267 hookEvent.response(mediaServerItemInuse, response);
268 logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId); 268 logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
269 - String streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.flv", mediaServerItemInuse.getHttpPort(), "rtp", ssrcInfo.getStream()); 269 + String streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream());
270 String path = "snap"; 270 String path = "snap";
271 String fileName = device.getDeviceId() + "_" + channelId + ".jpg"; 271 String fileName = device.getDeviceId() + "_" + channelId + ".jpg";
272 // 请求截图 272 // 请求截图
web_src/src/components/channelList.vue
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span> 69 <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span>
70 </template> 70 </template>
71 </el-table-column> 71 </el-table-column>
72 - <el-table-column prop="ptztypeText" label="云台类型" min-width="120"/> 72 + <el-table-column prop="PTZTypeText" label="云台类型" min-width="120"/>
73 <el-table-column label="开启音频" min-width="120"> 73 <el-table-column label="开启音频" min-width="120">
74 <template slot-scope="scope"> 74 <template slot-scope="scope">
75 <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF"> 75 <el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
web_src/src/components/common/jessibuca.vue
@@ -167,13 +167,7 @@ export default { @@ -167,13 +167,7 @@ export default {
167 _this.isNotMute = !msg; 167 _this.isNotMute = !msg;
168 }); 168 });
169 jessibuca.on("audioInfo", function (msg) { 169 jessibuca.on("audioInfo", function (msg) {
170 - // console.log("audioInfo", msg);  
171 - });  
172 -  
173 - jessibuca.on("videoInfo", function (msg) {  
174 - // this.videoInfo = msg;  
175 - console.log("videoInfo", msg);  
176 - 170 + console.log("audioInfo", msg);
177 }); 171 });
178 172
179 jessibuca.on("bps", function (bps) { 173 jessibuca.on("bps", function (bps) {