Commit 713aa00acc398e44cb2a59e4f5c3f55b4e0784d8

Authored by xiaoQQya
Committed by 648540858
1 parent 219f8631

perf(snap): 优化点播成功后截图使用 rtsp 流, 新增对 H265 编码视频截图的支持

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 // 请求截图