Commit 713aa00acc398e44cb2a59e4f5c3f55b4e0784d8
Committed by
648540858
1 parent
219f8631
perf(snap): 优化点播成功后截图使用 rtsp 流, 新增对 H265 编码视频截图的支持
Showing
3 changed files
with
4 additions
and
3 deletions
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 | // 请求截图 | ... | ... |