From 0772f6988588fe4d3fd9aa31d830a0671c333059 Mon Sep 17 00:00:00 2001 From: xiaoQQya Date: Mon, 20 Mar 2023 14:54:17 +0800 Subject: [PATCH] =?UTF-8?q?perf(snap):=20=E4=BC=98=E5=8C=96=E7=82=B9?= =?UTF-8?q?=E6=92=AD=E6=88=90=E5=8A=9F=E5=90=8E=E6=88=AA=E5=9B=BE=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20rtsp=20=E6=B5=81,=20=E6=96=B0=E5=A2=9E=E5=AF=B9=20H?= =?UTF-8?q?265=20=E7=BC=96=E7=A0=81=E8=A7=86=E9=A2=91=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java | 4 ++-- .../iot/vmp/service/impl/MediaServerServiceImpl.java | 1 + .../com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java index 3610f319..a2891973 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java @@ -323,9 +323,9 @@ public class ZLMRESTfulUtils { sendPost(mediaServerItem, "kick_sessions",param, null); } - public void getSnap(MediaServerItem mediaServerItem, String flvUrl, int timeout_sec, int expire_sec, String targetPath, String fileName) { + public void getSnap(MediaServerItem mediaServerItem, String streamUrl, int timeout_sec, int expire_sec, String targetPath, String fileName) { Map param = new HashMap<>(3); - param.put("url", flvUrl); + param.put("url", streamUrl); param.put("timeout_sec", timeout_sec); param.put("expire_sec", expire_sec); sendGetForImg(mediaServerItem, "getSnap", param, targetPath, fileName); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java index c93e449d..c45f9f0f 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java @@ -547,6 +547,7 @@ public class MediaServerServiceImpl implements IMediaServerService { Map param = new HashMap<>(); param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline + param.put("ffmpeg.snap", "%s -rtsp_transport tcp -i %s -y -f mjpeg -t 0.001 %s"); param.put("hook.enable","1"); param.put("hook.on_flow_report",""); param.put("hook.on_play",String.format("%s/on_play", hookPrex)); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 8b460861..582d9a74 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -266,7 +266,7 @@ public class PlayServiceImpl implements IPlayService { onPublishHandlerForPlay(mediaServerItemInuse, response, device.getDeviceId(), channelId); hookEvent.response(mediaServerItemInuse, response); logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId); - String streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.flv", mediaServerItemInuse.getHttpPort(), "rtp", ssrcInfo.getStream()); + String streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream()); String path = "snap"; String fileName = device.getDeviceId() + "_" + channelId + ".jpg"; // 请求截图