Commit ed08c7ef77b3466e8f388fe3ea3f6a94f324fa4e
Committed by
GitHub
Merge pull request #785 from xiaoQQya/wvp-28181-2.0
新增对 H265 编码视频截图的支持
Showing
6 changed files
with
10 additions
and
13 deletions
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
| ... | ... | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.common; |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | |
| 5 | 5 | import java.io.Serializable; |
| 6 | +import java.util.Objects; | |
| 6 | 7 | |
| 7 | 8 | @Schema(description = "流信息") |
| 8 | 9 | public class StreamInfo implements Serializable, Cloneable{ |
| ... | ... | @@ -168,7 +169,7 @@ public class StreamInfo implements Serializable, Cloneable{ |
| 168 | 169 | } |
| 169 | 170 | |
| 170 | 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 | 173 | if (port > 0) { |
| 173 | 174 | this.rtmp = new StreamURL("rtmp", host, port, file); |
| 174 | 175 | } |
| ... | ... | @@ -178,7 +179,7 @@ public class StreamInfo implements Serializable, Cloneable{ |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | 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 | 183 | if (port > 0) { |
| 183 | 184 | this.rtsp = new StreamURL("rtsp", host, port, file); |
| 184 | 185 | } |
| ... | ... | @@ -237,6 +238,7 @@ public class StreamInfo implements Serializable, Cloneable{ |
| 237 | 238 | } |
| 238 | 239 | |
| 239 | 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 | 242 | String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam); |
| 241 | 243 | if (port > 0) { |
| 242 | 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 | 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 | 327 | Map<String, Object> param = new HashMap<>(3); |
| 328 | - param.put("url", flvUrl); | |
| 328 | + param.put("url", streamUrl); | |
| 329 | 329 | param.put("timeout_sec", timeout_sec); |
| 330 | 330 | param.put("expire_sec", expire_sec); |
| 331 | 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 | 547 | |
| 548 | 548 | Map<String, Object> param = new HashMap<>(); |
| 549 | 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 | 551 | param.put("hook.enable","1"); |
| 551 | 552 | param.put("hook.on_flow_report",""); |
| 552 | 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 | 266 | onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId); |
| 267 | 267 | hookEvent.response(mediaServerItemInuse, response); |
| 268 | 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 | 270 | String path = "snap"; |
| 271 | 271 | String fileName = device.getDeviceId() + "_" + channelId + ".jpg"; |
| 272 | 272 | // 请求截图 | ... | ... |
web_src/src/components/channelList.vue
| ... | ... | @@ -69,7 +69,7 @@ |
| 69 | 69 | <span v-if="scope.row.longitude*scope.row.latitude === 0">无</span> |
| 70 | 70 | </template> |
| 71 | 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 | 73 | <el-table-column label="开启音频" min-width="120"> |
| 74 | 74 | <template slot-scope="scope"> |
| 75 | 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 | 167 | _this.isNotMute = !msg; |
| 168 | 168 | }); |
| 169 | 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 | 173 | jessibuca.on("bps", function (bps) { | ... | ... |