From 0b2f635176c71706d5dc33555497445367dc243b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 9 Apr 2024 10:30:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=9D=9E=E4=B8=BB=E7=BA=BF?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/media/abl/ABLHttpHookListener.java | 413 ---- .../media/abl/ABLMediaNodeServerService.java | 151 -- .../media/abl/ABLMediaServerStatusManger.java | 362 ---- ...LMediaServer高性能流媒体服务器使用说明.txt | 1743 ----------------- .../iot/vmp/media/abl/ABLRESTfulUtils.java | 317 --- .../vmp/media/abl/bean/AblServerConfig.java | 812 -------- .../iot/vmp/media/abl/bean/AblUrls.java | 58 - .../iot/vmp/media/abl/bean/ConfigKeyId.java | 10 - .../vmp/media/abl/bean/hook/ABLHookParam.java | 65 - .../abl/bean/hook/OnPlayABLHookParam.java | 31 - .../abl/bean/hook/OnPublishABLHookParam.java | 31 - .../bean/hook/OnRecordMp4ABLHookParam.java | 13 - .../hook/OnRecordProgressABLHookParam.java | 22 - .../hook/OnServerKeepaliveABLHookParam.java | 32 - .../bean/hook/OnServerStaredABLHookParam.java | 32 - .../bean/hook/OnStreamArriveABLHookParam.java | 245 --- .../event/HookAblServerKeepaliveEvent.java | 24 - .../abl/event/HookAblServerStartEvent.java | 24 - 18 files changed, 4385 deletions(-) delete mode 100755 src/main/java/com/genersoft/iot/vmp/media/abl/ABLHttpHookListener.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServerStatusManger.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServer高性能流媒体服务器使用说明.txt delete mode 100755 src/main/java/com/genersoft/iot/vmp/media/abl/ABLRESTfulUtils.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblServerConfig.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblUrls.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/ConfigKeyId.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/ABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPlayABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPublishABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordMp4ABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordProgressABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerKeepaliveABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerStaredABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnStreamArriveABLHookParam.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerKeepaliveEvent.java delete mode 100644 src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerStartEvent.java diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLHttpHookListener.java deleted file mode 100755 index 69e6d8cd..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLHttpHookListener.java +++ /dev/null @@ -1,413 +0,0 @@ -package com.genersoft.iot.vmp.media.abl; - -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; -import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; -import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; -import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; -import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; -import com.genersoft.iot.vmp.media.abl.bean.hook.*; -import com.genersoft.iot.vmp.media.abl.event.HookAblServerKeepaliveEvent; -import com.genersoft.iot.vmp.media.abl.event.HookAblServerStartEvent; -import com.genersoft.iot.vmp.media.bean.MediaServer; -import com.genersoft.iot.vmp.media.bean.ResultForOnPublish; -import com.genersoft.iot.vmp.media.event.hook.HookSubscribe; -import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent; -import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent; -import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent; -import com.genersoft.iot.vmp.media.event.media.MediaRtpServerTimeoutEvent; -import com.genersoft.iot.vmp.media.service.IMediaServerService; -import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; -import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResult; -import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResultForOnPublish; -import com.genersoft.iot.vmp.service.*; -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.util.ObjectUtils; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletRequest; -import java.util.HashMap; -import java.util.Map; - -/** - * ABL 的hook事件监听 - */ -@RestController -@RequestMapping("/index/hook/abl") -public class ABLHttpHookListener { - - private final static Logger logger = LoggerFactory.getLogger(ABLHttpHookListener.class); - - @Autowired - private ABLRESTfulUtils ablresTfulUtils; - - @Autowired - private ISIPCommanderForPlatform commanderFroPlatform; - - @Autowired - private AudioBroadcastManager audioBroadcastManager; - - @Autowired - private IPlayService playService; - - @Autowired - private IVideoManagerStorage storager; - - @Autowired - private IRedisCatchStorage redisCatchStorage; - - @Autowired - private IInviteStreamService inviteStreamService; - - @Autowired - private IDeviceService deviceService; - - @Autowired - private IMediaServerService mediaServerService; - - @Autowired - private IStreamProxyService streamProxyService; - - @Autowired - private DeferredResultHolder resultHolder; - - @Autowired - private IMediaService mediaService; - - @Autowired - private EventPublisher eventPublisher; - - @Autowired - private ZLMMediaListManager zlmMediaListManager; - - @Autowired - private HookSubscribe subscribe; - - @Autowired - private UserSetting userSetting; - - @Autowired - private IUserService userService; - - @Autowired - private ICloudRecordService cloudRecordService; - - @Autowired - private VideoStreamSessionManager sessionManager; - - @Autowired - private SSRCFactory ssrcFactory; - - @Qualifier("taskExecutor") - @Autowired - private ThreadPoolTaskExecutor taskExecutor; - - @Autowired - private RedisTemplate redisTemplate; - - @Autowired - private ApplicationEventPublisher applicationEventPublisher; - - /** - * 服务器定时上报时间,上报间隔可配置,默认10s上报一次 - */ - @ResponseBody - @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8") - public HookResult onServerKeepalive(@RequestBody OnServerKeepaliveABLHookParam param) { - try { - HookAblServerKeepaliveEvent event = new HookAblServerKeepaliveEvent(this); - MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServerItem != null) { - event.setMediaServerItem(mediaServerItem); - applicationEventPublisher.publishEvent(event); - } - }catch (Exception e) { - logger.info("[ZLM-HOOK-心跳] 发送通知失败 ", e); - } - return HookResult.SUCCESS(); - } - - /** - * 播放器鉴权事件,rtsp/rtmp/http-flv/ws-flv/hls的播放都将触发此鉴权事件。 - */ - @ResponseBody - @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8") - public HookResult onPlay(@RequestBody OnPlayABLHookParam param) { - - MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServer == null) { - return new HookResultForOnPublish(0, "success"); - } - - Map paramMap = urlParamToMap(param.getParams()); - // 对于播放流进行鉴权 - boolean authenticateResult = mediaService.authenticatePlay(param.getApp(), param.getStream(), paramMap.get("callId")); - if (!authenticateResult) { - logger.info("[ABL HOOK] 播放鉴权 失败:{}->{}", param.getMediaServerId(), param); - ablresTfulUtils.closeStreams(mediaServer, param.getApp(), param.getStream()); - - } - logger.info("[ABL HOOK] 播放鉴权成功:{}->{}", param.getMediaServerId(), param); - return HookResult.SUCCESS(); - } - - /** - * rtsp/rtmp/rtp推流鉴权事件。 - */ - @ResponseBody - @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8") - public HookResult onPublish(@RequestBody OnPublishABLHookParam param) { - - - logger.info("[ABL HOOK]推流鉴权:{}->{}", param.getMediaServerId(), param); - // TODO 加快处理速度 - - MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServer == null) { - return new HookResultForOnPublish(0, "success"); - } - - ResultForOnPublish resultForOnPublish = mediaService.authenticatePublish(mediaServer, param.getApp(), param.getStream(), param.getParams()); - if (resultForOnPublish == null) { - logger.info("[ABL HOOK]推流鉴权 拒绝 响应:{}->{}", param.getMediaServerId(), param); - ablresTfulUtils.closeStreams(mediaServer, param.getApp(), param.getStream()); - } - return HookResult.SUCCESS(); - } - - /** - * 如果某一个码流进行MP4录像(enable_mp4=1),会触发录像进度通知事件 - */ - @ResponseBody - @PostMapping(value = "/on_record_progress", produces = "application/json;charset=UTF-8") - public HookResult onRecordProgress(@RequestBody OnRecordProgressABLHookParam param) { - - - logger.info("[ABL HOOK] 录像进度通知:{}->{}/{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream(), param.getCurrentFileDuration(), param.getTotalVideoDuration()); - - // TODO 这里用来做录像进度 -// MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); -// if (mediaServer == null) { -// return new HookResultForOnPublish(0, "success"); -// } -// -// ResultForOnPublish resultForOnPublish = mediaService.authenticatePublish(mediaServer, param.getApp(), param.getStream(), param.getParams()); -// if (resultForOnPublish == null) { -// logger.info("[ABL HOOK]推流鉴权 拒绝 响应:{}->{}", param.getMediaServerId(), param); -// ablresTfulUtils.closeStreams(mediaServer, param.getApp(), param.getStream()); -// } - return HookResult.SUCCESS(); - } - - /** - * 当代理拉流、国标接入等等 码流不到达时会发出 码流不到达的事件通知 - */ - @ResponseBody - @PostMapping(value = "/on_stream_not_arrive", produces = "application/json;charset=UTF-8") - public HookResult onStreamNotArrive(@RequestBody ABLHookParam param) { - - - logger.info("[ABL HOOK] 码流不到达通知:{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); - try { - if ("rtp".equals(param.getApp())) { - return HookResult.SUCCESS(); - } - MediaRtpServerTimeoutEvent event = new MediaRtpServerTimeoutEvent(this); - MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServerItem != null) { - event.setMediaServer(mediaServerItem); - event.setApp("rtp"); - applicationEventPublisher.publishEvent(event); - } - }catch (Exception e) { - logger.info("[ABL-HOOK-码流不到达通知] 发送通知失败 ", e); - } - - return HookResult.SUCCESS(); - } - - /** - * 如果某一个码流进行MP4录像(enable_mp4=1),当某个MP4文件被删除会触发该事件通知 - */ - @ResponseBody - @PostMapping(value = "/on_delete_record_mp4", produces = "application/json;charset=UTF-8") - public HookResult onDeleteRecordMp4(@RequestBody OnRecordMp4ABLHookParam param) { - - - logger.info("[ABL HOOK] MP4文件被删除通知:{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); - - - return HookResult.SUCCESS(); - } - - - /** - * rtsp/rtmp流注册或注销时触发此事件;此事件对回复不敏感。 - */ - @ResponseBody - @PostMapping(value = "/on_stream_arrive", produces = "application/json;charset=UTF-8") - public HookResult onStreamArrive(@RequestBody OnStreamArriveABLHookParam param) { - - MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServer == null) { - return HookResult.SUCCESS(); - } - - logger.info("[ABL HOOK] 码流到达, {}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); - MediaArrivalEvent mediaArrivalEvent = MediaArrivalEvent.getInstance(this, param, mediaServer); - applicationEventPublisher.publishEvent(mediaArrivalEvent); - return HookResult.SUCCESS(); - } - - /** - * 流无人观看时事件,用户可以通过此事件选择是否关闭无人看的流。 - */ - @ResponseBody - @PostMapping(value = "/on_stream_none_reader", produces = "application/json;charset=UTF-8") - public JSONObject onStreamNoneReader(@RequestBody ABLHookParam param) { - - logger.info("[ZLM HOOK]流无人观看:{}->{}/{}", param.getMediaServerId(), - param.getApp(), param.getStream()); - JSONObject ret = new JSONObject(); - - boolean close = mediaService.closeStreamOnNoneReader(param.getMediaServerId(), param.getApp(), param.getStream(), null); - ret.put("code", close); - return ret; - } - - /** - * 当播放一个url,如果不存在时,会发出一个消息通知 - */ - @ResponseBody - @PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8") - public HookResult onStreamNotFound(@RequestBody ABLHookParam param) { - logger.info("[ABL HOOK] 流未找到:{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); - - - MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); - if (!userSetting.isAutoApplyPlay() || mediaServer == null) { - return HookResult.SUCCESS(); - } - MediaNotFoundEvent mediaNotFoundEvent = MediaNotFoundEvent.getInstance(this, param, mediaServer); - applicationEventPublisher.publishEvent(mediaNotFoundEvent); - return HookResult.SUCCESS(); - } - - /** - * ABLMediaServer启动时会发送上线通知 - */ - @ResponseBody - @PostMapping(value = "/on_server_started", produces = "application/json;charset=UTF-8") - public HookResult onServerStarted(HttpServletRequest request, @RequestBody OnServerStaredABLHookParam param) { - - logger.info("[ABL HOOK] 启动 " + param.getMediaServerId()); - try { - HookAblServerStartEvent event = new HookAblServerStartEvent(this); - MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServerItem != null) { - event.setMediaServerItem(mediaServerItem); - applicationEventPublisher.publishEvent(event); - } - }catch (Exception e) { - logger.info("[ABL-HOOK-启动] 发送通知失败 ", e); - } - - return HookResult.SUCCESS(); - } - - /** - * TODO 发送rtp(startSendRtp)被动关闭时回调 - */ -// @ResponseBody -// @PostMapping(value = "/on_send_rtp_stopped", produces = "application/json;charset=UTF-8") -// public HookResult onSendRtpStopped(HttpServletRequest request, @RequestBody OnSendRtpStoppedHookParam param) { -// -// logger.info("[ZLM HOOK] rtp发送关闭:{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); -// -// // 查找对应的上级推流,发送停止 -// if (!"rtp".equals(param.getApp())) { -// return HookResult.SUCCESS(); -// } -// try { -// MediaSendRtpStoppedEvent event = new MediaSendRtpStoppedEvent(this); -// MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); -// if (mediaServerItem != null) { -// event.setMediaServer(mediaServerItem); -// applicationEventPublisher.publishEvent(event); -// } -// }catch (Exception e) { -// logger.info("[ZLM-HOOK-rtp发送关闭] 发送通知失败 ", e); -// } -// -// return HookResult.SUCCESS(); -// } - - /** - * TODO 录像完成事件 - */ - @ResponseBody - @PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8") - public HookResult onRecordMp4(HttpServletRequest request, @RequestBody OnRecordMp4ABLHookParam param) { - logger.info("[ABL HOOK] 录像完成事件:{}->{}", param.getMediaServerId(), param.getFileName()); - -// try { -// MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId()); -// if (mediaServerItem != null) { -// MediaRecordMp4Event event = MediaRecordMp4Event.getInstance(this, param, mediaServerItem); -// event.setMediaServer(mediaServerItem); -// applicationEventPublisher.publishEvent(event); -// } -// }catch (Exception e) { -// logger.info("[ZLM-HOOK-rtpServer收流超时] 发送通知失败 ", e); -// } - - return HookResult.SUCCESS(); - } - - /** - * 当某一路码流断开时会发送通知 - */ - @ResponseBody - @PostMapping(value = "/on_stream_disconnect", produces = "application/json;charset=UTF-8") - public HookResult onRecordMp4(HttpServletRequest request, @RequestBody ABLHookParam param) { - logger.info("[ABL HOOK] 码流断开事件, {}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream()); - - MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId()); - if (mediaServer == null) { - return HookResult.SUCCESS(); - } - - MediaDepartureEvent mediaDepartureEvent = MediaDepartureEvent.getInstance(this, param, mediaServer); - applicationEventPublisher.publishEvent(mediaDepartureEvent); - - return HookResult.SUCCESS(); - } - - private Map urlParamToMap(String params) { - HashMap map = new HashMap<>(); - if (ObjectUtils.isEmpty(params)) { - return map; - } - String[] paramsArray = params.split("&"); - if (paramsArray.length == 0) { - return map; - } - for (String param : paramsArray) { - String[] paramArray = param.split("="); - if (paramArray.length == 2) { - map.put(paramArray[0], paramArray[1]); - } - } - return map; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java deleted file mode 100644 index 110c0cbb..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.genersoft.iot.vmp.media.abl; - -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.common.CommonCallback; -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.media.bean.MediaInfo; -import com.genersoft.iot.vmp.media.bean.MediaServer; -import com.genersoft.iot.vmp.media.service.IMediaNodeServerService; -import com.genersoft.iot.vmp.vmanager.bean.WVPResult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service("abl") -public class ABLMediaNodeServerService implements IMediaNodeServerService { - - private final static Logger logger = LoggerFactory.getLogger(ABLMediaNodeServerService.class); - - @Autowired - private ABLRESTfulUtils ablresTfulUtils; - - @Override - public int createRTPServer(MediaServer mediaServer, String stream, long ssrc, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode) { - return ablresTfulUtils.openRtpServer(mediaServer, "rtp", stream, 96, port, tcpMode, disableAudio?1:0); - } - - @Override - public void closeRtpServer(MediaServer mediaServer, String streamId) { - closeRtpServer(mediaServer, streamId, null); - } - - @Override - public void closeRtpServer(MediaServer serverItem, String streamId, CommonCallback callback) { - if (serverItem == null) { - return; - } - Map param = new HashMap<>(); - param.put("stream_id", streamId); - param.put("force", 1); - JSONObject jsonObject = ablresTfulUtils.closeStreams(serverItem, "rtp", streamId); - logger.info("关闭RTP Server " + jsonObject); - if (jsonObject != null ) { - if (jsonObject.getInteger("code") != 0) { - logger.error("关闭RTP Server 失败: " + jsonObject.getString("msg")); - } - }else { - // 检查ZLM状态 - logger.error("关闭RTP Server 失败: 请检查ZLM服务"); - } - } - - @Override - public void closeStreams(MediaServer mediaServerItem, String rtp, String streamId) { - - } - - @Override - public Boolean updateRtpServerSSRC(MediaServer mediaServerItem, String streamId, String ssrc) { - return null; - } - - @Override - public boolean checkNodeId(MediaServer mediaServerItem) { - return false; - } - - @Override - public void online(MediaServer mediaServerItem) { - - } - - @Override - public MediaServer checkMediaServer(String ip, int port, String secret) { - return null; - } - - @Override - public boolean stopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc) { - return false; - } - - @Override - public boolean deleteRecordDirectory(MediaServer mediaServerItem, String app, String stream, String date, String fileName) { - return false; - } - - @Override - public List getMediaList(MediaServer mediaServerItem, String app, String stream, String callId) { - return null; - } - - @Override - public Boolean connectRtpServer(MediaServer mediaServerItem, String address, int port, String stream) { - return null; - } - - @Override - public void getSnap(MediaServer mediaServerItem, String streamUrl, int timeoutSec, int expireSec, String path, String fileName) { - - } - - @Override - public MediaInfo getMediaInfo(MediaServer mediaServerItem, String app, String stream) { - return null; - } - - @Override - public Boolean pauseRtpCheck(MediaServer mediaServer, String streamKey) { - return null; - } - - @Override - public Boolean resumeRtpCheck(MediaServer mediaServer, String streamKey) { - return null; - } - - @Override - public String getFfmpegCmd(MediaServer mediaServer, String cmdKey) { - return null; - } - - @Override - public WVPResult addFFmpegSource(MediaServer mediaServer, String srcUrl, String dstUrl, int timeoutMs, boolean enableAudio, boolean enableMp4, String ffmpegCmdKey) { - return null; - } - - @Override - public WVPResult addStreamProxy(MediaServer mediaServer, String app, String stream, String url, boolean enableAudio, boolean enableMp4, String rtpType) { - return null; - } - - @Override - public Boolean delFFmpegSource(MediaServer mediaServer, String streamKey) { - return null; - } - - @Override - public Boolean delStreamProxy(MediaServer mediaServer, String streamKey) { - return null; - } - - @Override - public Map getFFmpegCMDs(MediaServer mediaServer) { - return null; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServerStatusManger.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServerStatusManger.java deleted file mode 100644 index cb55695b..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServerStatusManger.java +++ /dev/null @@ -1,362 +0,0 @@ -package com.genersoft.iot.vmp.media.abl; - -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.conf.DynamicTask; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.media.abl.bean.AblServerConfig; -import com.genersoft.iot.vmp.media.abl.bean.ConfigKeyId; -import com.genersoft.iot.vmp.media.abl.event.HookAblServerKeepaliveEvent; -import com.genersoft.iot.vmp.media.abl.event.HookAblServerStartEvent; -import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerChangeEvent; -import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerDeleteEvent; -import com.genersoft.iot.vmp.media.service.IMediaServerService; -import com.genersoft.iot.vmp.media.bean.MediaServer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.lang.reflect.Field; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 管理zlm流媒体节点的状态 - */ -@Component -public class ABLMediaServerStatusManger { - - private final static Logger logger = LoggerFactory.getLogger(ABLMediaServerStatusManger.class); - - private final Map offlineABLPrimaryMap = new ConcurrentHashMap<>(); - private final Map offlineAblsecondaryMap = new ConcurrentHashMap<>(); - private final Map offlineAblTimeMap = new ConcurrentHashMap<>(); - - @Autowired - private ABLRESTfulUtils ablResTfulUtils; - - @Autowired - private IMediaServerService mediaServerService; - - @Autowired - private DynamicTask dynamicTask; - - @Value("${server.ssl.enabled:false}") - private boolean sslEnabled; - - @Value("${server.port}") - private Integer serverPort; - - @Autowired - private UserSetting userSetting; - - private final String type = "abl"; - - @Async("taskExecutor") - @EventListener - public void onApplicationEvent(MediaServerChangeEvent event) { - if (event.getMediaServerItemList() == null - || event.getMediaServerItemList().isEmpty()) { - return; - } - for (MediaServer mediaServerItem : event.getMediaServerItemList()) { - if (!type.equals(mediaServerItem.getType())) { - continue; - } - logger.info("[ABL-添加待上线节点] ID:" + mediaServerItem.getId()); - offlineABLPrimaryMap.put(mediaServerItem.getId(), mediaServerItem); - offlineAblTimeMap.put(mediaServerItem.getId(), System.currentTimeMillis()); - } - } - - @Async("taskExecutor") - @EventListener - public void onApplicationEvent(HookAblServerStartEvent event) { - if (event.getMediaServerItem() == null - || !type.equals(event.getMediaServerItem().getType()) - || event.getMediaServerItem().isStatus()) { - return; - } - MediaServer serverItem = mediaServerService.getOne(event.getMediaServerItem().getId()); - if (serverItem == null) { - return; - } - logger.info("[ABL-HOOK事件-服务启动] ID:" + event.getMediaServerItem().getId()); - online(serverItem, null); - } - - @Async("taskExecutor") - @EventListener - public void onApplicationEvent(HookAblServerKeepaliveEvent event) { - if (event.getMediaServerItem() == null) { - return; - } - MediaServer serverItem = mediaServerService.getOne(event.getMediaServerItem().getId()); - if (serverItem == null) { - return; - } - logger.info("[ABL-HOOK事件-心跳] ID:" + event.getMediaServerItem().getId()); - online(serverItem, null); - } - - @Async("taskExecutor") - @EventListener - public void onApplicationEvent(MediaServerDeleteEvent event) { - if (event.getMediaServerId() == null) { - return; - } - logger.info("[ABL-节点被移除] ID:" + event.getMediaServerId()); - offlineABLPrimaryMap.remove(event.getMediaServerId()); - offlineAblsecondaryMap.remove(event.getMediaServerId()); - offlineAblTimeMap.remove(event.getMediaServerId()); - } - - @Scheduled(fixedDelay = 10*1000) //每隔10秒检查一次 - public void execute(){ - // 初次加入的离线节点会在30分钟内,每间隔十秒尝试一次,30分钟后如果仍然没有上线,则每隔30分钟尝试一次连接 - if (offlineABLPrimaryMap.isEmpty() && offlineAblsecondaryMap.isEmpty()) { - return; - } - if (!offlineABLPrimaryMap.isEmpty()) { - for (MediaServer mediaServerItem : offlineABLPrimaryMap.values()) { - if (offlineAblTimeMap.get(mediaServerItem.getId()) < System.currentTimeMillis() - 30*60*1000) { - offlineAblsecondaryMap.put(mediaServerItem.getId(), mediaServerItem); - offlineABLPrimaryMap.remove(mediaServerItem.getId()); - continue; - } - logger.info("[ABL-尝试连接] ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - JSONObject responseJson = ablResTfulUtils.getServerConfig(mediaServerItem); - AblServerConfig ablServerConfig = null; - if (responseJson == null) { - logger.info("[ABL-尝试连接]失败, ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - continue; - } - JSONArray data = responseJson.getJSONArray("params"); - if (data == null || data.isEmpty()) { - logger.info("[ABL-尝试连接]失败, ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - }else { - ablServerConfig = AblServerConfig.getInstance(data); - initPort(mediaServerItem, ablServerConfig); - online(mediaServerItem, ablServerConfig); - } - } - } - if (!offlineAblsecondaryMap.isEmpty()) { - for (MediaServer mediaServerItem : offlineAblsecondaryMap.values()) { - if (offlineAblTimeMap.get(mediaServerItem.getId()) < System.currentTimeMillis() - 30*60*1000) { - continue; - } - logger.info("[ABL-尝试连接] ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - JSONObject responseJson = ablResTfulUtils.getServerConfig(mediaServerItem); - AblServerConfig ablServerConfig = null; - if (responseJson == null) { - logger.info("[ABL-尝试连接]失败, ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - offlineAblTimeMap.put(mediaServerItem.getId(), System.currentTimeMillis()); - continue; - } - JSONArray data = responseJson.getJSONArray("params"); - if (data == null || data.isEmpty()) { - logger.info("[ABL-尝试连接]失败, ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - offlineAblTimeMap.put(mediaServerItem.getId(), System.currentTimeMillis()); - }else { - ablServerConfig = AblServerConfig.getInstance(data); - initPort(mediaServerItem, ablServerConfig); - online(mediaServerItem, ablServerConfig); - } - } - } - } - - private void online(MediaServer mediaServerItem, AblServerConfig config) { - offlineABLPrimaryMap.remove(mediaServerItem.getId()); - offlineAblsecondaryMap.remove(mediaServerItem.getId()); - offlineAblTimeMap.remove(mediaServerItem.getId()); - if (!mediaServerItem.isStatus()) { - logger.info("[ABL-连接成功] ID:{}, 地址: {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); - mediaServerItem.setStatus(true); - mediaServerItem.setHookAliveInterval(10F); - mediaServerService.update(mediaServerItem); - if(mediaServerItem.isAutoConfig()) { - if (config == null) { - JSONObject responseJSON = ablResTfulUtils.getServerConfig(mediaServerItem); - JSONArray data = responseJSON.getJSONArray("params"); - if (data != null && !data.isEmpty()) { - config = AblServerConfig.getInstance(data); - } - } - if (config != null) { - initPort(mediaServerItem, config); - setAblConfig(mediaServerItem, false, config); - } - } - mediaServerService.update(mediaServerItem); - } - // 设置两次心跳未收到则认为zlm离线 - String key = "ABL-keepalive-" + mediaServerItem.getId(); - dynamicTask.startDelay(key, ()->{ - logger.warn("[ABL-心跳超时] ID:{}", mediaServerItem.getId()); - mediaServerItem.setStatus(false); - offlineABLPrimaryMap.put(mediaServerItem.getId(), mediaServerItem); - offlineAblTimeMap.put(mediaServerItem.getId(), System.currentTimeMillis()); - // TODO 发送离线通知 - mediaServerService.update(mediaServerItem); - }, (int)(mediaServerItem.getHookAliveInterval() * 2 * 1000)); - } - private void initPort(MediaServer mediaServerItem, AblServerConfig ablServerConfig) { - // 端口只会从配置中读取一次,一旦自己配置或者读取过了将不在配置 -// if (mediaServerItem.getHttpSSlPort() == 0) { -// mediaServerItem.setHttpSSlPort(ablServerConfig.getHttpSSLport()); -// } - if (mediaServerItem.getRtmpPort() == 0 && ablServerConfig.getRtmpPort() != null) { - mediaServerItem.setRtmpPort(ablServerConfig.getRtmpPort()); - } -// if (mediaServerItem.getRtmpSSlPort() == 0) { -// mediaServerItem.setRtmpSSlPort(ablServerConfig.getRtmpSslPort()); -// } - if (mediaServerItem.getRtspPort() == 0 && ablServerConfig.getRtspPort() != null) { - mediaServerItem.setRtspPort(ablServerConfig.getRtspPort()); - } - if (mediaServerItem.getFlvPort() == 0 && ablServerConfig.getHttpFlvPort() != null) { - mediaServerItem.setFlvPort(ablServerConfig.getHttpFlvPort()); - } - if (mediaServerItem.getWsFlvPort() == 0 && ablServerConfig.getWsPort() != null) { - mediaServerItem.setWsFlvPort(ablServerConfig.getWsPort()); - } - if (mediaServerItem.getRtpProxyPort() == 0 && ablServerConfig.getPsTsRecvPort() != null) { - mediaServerItem.setRtpProxyPort(ablServerConfig.getPsTsRecvPort()); - } -// if (mediaServerItem.getRtspSSLPort() == 0) { -// mediaServerItem.setRtspSSLPort(ablServerConfig.getRtspSSlport()); -// } -// if (mediaServerItem.getRtpProxyPort() == 0) { -// mediaServerItem.setRtpProxyPort(ablServerConfig.getRtpProxyPort()); -// } - mediaServerItem.setHookAliveInterval(10F); - } - - public void setAblConfig(MediaServer mediaServerItem, boolean restart, AblServerConfig config) { - try { - if (config.getHookEnable() == 0) { - logger.info("[媒体服务节点-ABL] 开启HOOK功能 :{}", mediaServerItem.getId()); - JSONObject responseJSON = ablResTfulUtils.setConfigParamValue(mediaServerItem, "hook_enable", "1"); - if (responseJSON.getInteger("code") == 0) { - logger.info("[媒体服务节点-ABL] 开启HOOK功能成功 :{}", mediaServerItem.getId()); - }else { - logger.info("[媒体服务节点-ABL] 开启HOOK功能失败 :{}->{}", mediaServerItem.getId(), responseJSON.getString("memo")); - } - } - }catch (Exception e) { - logger.info("[媒体服务节点-ABL] 开启HOOK功能失败 :{}", mediaServerItem.getId(), e); - } - // 设置相关的HOOK - String[] hookUrlArray = { - "on_stream_arrive", - "on_stream_none_reader", - "on_record_mp4", - "on_stream_disconnect", - "on_stream_not_found", - "on_server_started", - "on_publish", - "on_play", - "on_record_progress", - "on_server_keepalive", - "on_stream_not_arrive", - "on_delete_record_mp4", - }; - - String protocol = sslEnabled ? "https" : "http"; - String hookPrefix = String.format("%s://%s:%s/index/hook/abl", protocol, mediaServerItem.getHookIp(), serverPort); - Field[] fields = AblServerConfig.class.getDeclaredFields(); - for (Field field : fields) { - try { - if (field.isAnnotationPresent(ConfigKeyId.class)) { - ConfigKeyId configKeyId = field.getAnnotation(ConfigKeyId.class); - for (String hook : hookUrlArray) { - if (configKeyId.value().equals(hook)) { - String hookUrl = String.format("%s/%s", hookPrefix, hook); - field.setAccessible(true); - // 利用反射获取值后对比是否与配置中相同,不同则进行设置 - if (!hookUrl.equals(field.get(config))) { - JSONObject responseJSON = ablResTfulUtils.setConfigParamValue(mediaServerItem, hook, hookUrl); - if (responseJSON.getInteger("code") == 0) { - logger.info("[媒体服务节点-ABL] 设置HOOK {} 成功 :{}", hook, mediaServerItem.getId()); - }else { - logger.info("[媒体服务节点-ABL] 设置HOOK {} 失败 :{}->{}", hook, mediaServerItem.getId(), responseJSON.getString("memo")); - } - } - } - } - } - }catch (Exception e) { - logger.info("[媒体服务节点-ABL] 设置HOOK 失败 :{}", mediaServerItem.getId(), e); - } - } - - - - -// Map param = new HashMap<>(); -// param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline -// if (mediaServerItem.getRtspPort() != 0) { -// param.put("ffmpeg.snap", "%s -rtsp_transport tcp -i %s -y -f mjpeg -frames:v 1 %s"); -// } -// param.put("hook.enable","1"); -// param.put("hook.on_flow_report",""); -// param.put("hook.on_play",String.format("%s/on_play", hookPrefix)); -// param.put("hook.on_http_access",""); -// param.put("hook.on_publish", String.format("%s/on_publish", hookPrefix)); -// param.put("hook.on_record_ts",""); -// param.put("hook.on_rtsp_auth",""); -// param.put("hook.on_rtsp_realm",""); -// param.put("hook.on_server_started",String.format("%s/on_server_started", hookPrefix)); -// param.put("hook.on_shell_login",""); -// param.put("hook.on_stream_changed",String.format("%s/on_stream_changed", hookPrefix)); -// param.put("hook.on_stream_none_reader",String.format("%s/on_stream_none_reader", hookPrefix)); -// param.put("hook.on_stream_not_found",String.format("%s/on_stream_not_found", hookPrefix)); -// param.put("hook.on_server_keepalive",String.format("%s/on_server_keepalive", hookPrefix)); -// param.put("hook.on_send_rtp_stopped",String.format("%s/on_send_rtp_stopped", hookPrefix)); -// param.put("hook.on_rtp_server_timeout",String.format("%s/on_rtp_server_timeout", hookPrefix)); -// param.put("hook.on_record_mp4",String.format("%s/on_record_mp4", hookPrefix)); -// param.put("hook.timeoutSec","30"); -// param.put("hook.alive_interval", mediaServerItem.getHookAliveInterval()); -// // 推流断开后可以在超时时间内重新连接上继续推流,这样播放器会接着播放。 -// // 置0关闭此特性(推流断开会导致立即断开播放器) -// // 此参数不应大于播放器超时时间 -// // 优化此消息以更快的收到流注销事件 -// param.put("protocol.continue_push_ms", "3000" ); -// // 最多等待未初始化的Track时间,单位毫秒,超时之后会忽略未初始化的Track, 设置此选项优化那些音频错误的不规范流, -// // 等zlm支持给每个rtpServer设置关闭音频的时候可以不设置此选项 -// if (mediaServerItem.isRtpEnable() && !ObjectUtils.isEmpty(mediaServerItem.getRtpPortRange())) { -// param.put("rtp_proxy.port_range", mediaServerItem.getRtpPortRange().replace(",", "-")); -// } -// -// if (!ObjectUtils.isEmpty(mediaServerItem.getRecordPath())) { -// File recordPathFile = new File(mediaServerItem.getRecordPath()); -// param.put("protocol.mp4_save_path", recordPathFile.getParentFile().getPath()); -// param.put("protocol.downloadRoot", recordPathFile.getParentFile().getPath()); -// param.put("record.appName", recordPathFile.getName()); -// } -// -// JSONObject responseJSON = ablResTfulUtils.setConfigParamValue(mediaServerItem, param); -// -// if (responseJSON != null && responseJSON.getInteger("code") == 0) { -// if (restart) { -// logger.info("[媒体服务节点] 设置成功,开始重启以保证配置生效 {} -> {}:{}", -// mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); -// ablResTfulUtils.restartServer(mediaServerItem); -// }else { -// logger.info("[媒体服务节点] 设置成功 {} -> {}:{}", -// mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); -// } -// }else { -// logger.info("[媒体服务节点] 设置媒体服务节点失败 {} -> {}:{}", -// mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); -// } - } - -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServer高性能流媒体服务器使用说明.txt b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServer高性能流媒体服务器使用说明.txt deleted file mode 100644 index 9cffc983..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaServer高性能流媒体服务器使用说明.txt +++ /dev/null @@ -1,1743 +0,0 @@ -一、功能说明 - ABLMediaServer高性能流媒体服务器,windows平台采用高性能的完成端口网络模型、Linux下采用epoll,加上线程池进行媒体数据 - 的接收、转换、发送。服务器的性能强劲、运行稳定,坚如磐石。经过压力测试比较,转发性能、CPU占有率、运行稳定性优势明显 。可 - 以通过ffmpeg命令或者其他标准的rtsp、rtmp推流函数往ABLMediaServer推送rtsp流、rtmp流,请求服务器代理拉流,请求服务器接收国 - 标GB28181。服务器通过转换,输出标准的rtsp码流、rtmp码流、http-flv、ws-flv 码流(支持H265视频输出)、http-mp4(视频支持H264、 - H265,音频支持AAC)、hls码流输出(视频支持H264、H265,音频支持AAC)、GB28181码流(国标PS流 )输出。 - 流媒体服务器支持录像、支持智能录像删除、录像查询、录像文件点播、录像文件极速下载。http-flv、ws-flv、http-mp4 协议点播时 - 支持暂停继续、支持拖动播放。rtsp点播录像文件时支持慢放(1/16、1/8、1/4、1/2),快放(2、4、8、16 )、正常速度、支持拖动播放。 - 流媒体服务器支秒级(基本上1秒以内)图片抓拍,支持对抓拍的图片进行查找,支持抓拍图片以http协议下载。 - 服务器支持H265转码为H264,转码输出视频支持指定分辨率、宽高、码率大小等等参数。Windows平台支持英伟达显卡硬件加速转码。实 - 测linux 平台能最大并发转码40路H265(硬件环境 至强 E5 2650 V3),实测windows 平台能最大并发转码35路H265(i9 + 英伟达 RTX 2080) - Linux 新增支持英伟达专业显卡,支持硬件解码、硬件编码,支持多个显卡同时进行转码。两张特斯拉T4(16G)显卡可以同时把80路1080P - 的H265视频转码为 1280 x 720 的H264,转码延时低于10毫秒,如果需要更强的转码功能可以多插几张显卡或者集群 。 - 服务器支持转码出来的视频打入自定义水印,支持水印的字符内容、字体大小、 字体颜色、字体位置都可以在配置文件中配置。 - 非常感谢ZLMediaKit和Media-Server 两个工程项目的作者,ABLMediaSever参考复用了ZLMediaKit的http请求函数的参数表(请求的URL - 及请求的参数名及一些初始值)以及整个框架的一些设计思想。直接调用了Media-Server 工程的 rtmp、flv、hls、fmp4 复用与解复用等等。 - 非常崇拜与感谢两位大佬为中国的开源流媒体努力与付出,再次感谢。 - - 【欢迎加入高性能流媒体服务QQ群 873666268 】 - -二、ABLMediaServer主要功能 - - 网络协议媒体输入 - rtsp、rtmp外部主动推流输入 - 1、rtsp外部主动推流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 2、rtmp外部主动推流 (支持 视频:H264、H265 ,音频:AAC) - 3、国标GB28181输入 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 4、交通运输部jtt1078 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - - rtsp、rtmp、http-flv、本地mp4文件 拉流输入: - 1、rtsp 拉流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 2、rtmp 拉流 (支持 视频:H264、H265 ,音频:AAC) - 3、http-flv 拉流 (支持 视频:H264、H265 ,音频:AAC) - 4、本地mp4 拉流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - - websock方式私有协议发送PCM数据进入流媒体服务器(可以在浏览器录音通过websocket以下面的私有协议把语音接入流媒体服务器方便国标对讲、或者其他应用比如语音广播) - 1、数据包格式 - 包头 + 数据类型 + 长度 + 数据包 - 包头4个字节 0xAB 0xCD 0xEF 0xAB - 数据类型  1 个字节 ,[ 0x01 推流音频注册 ] [0x02 发送 PCM 音频数据包] [0x03 断开音频推流 ] - 长度   2 个字节 ,网络字节顺序(大端) - 数据包 音频注册包、pcm音频数据包、注销包 - - 2、数据包类型 - 1)、音频注册包 ,json 格式 - {"method":"register","app":"talk","stream":"xian_1","audioCodec":"pcm","channels":1,"sampleRate":16000,"targetAudioCodec":"g711a"} - - 样例:发送音频注册 - websocket 只要连接上来,就首先发送 音频注册包 - (0xAB 0xCD 0xEF 0xAB) + 0x01 + strlen(音频注册包) + {"method":"register","app":"talk","stream":"xian_1","audioCodec":"pcm","channels":1,"sampleRate":16000,"targetAudioCodec":"g711a"} - - 2) 、音频数据包 只支持 16位采样精度的pcm ,单通道、双通道、常见的采样频率都支持(8000、16000、32000、48000) - 样例:现在只发送纯pcm音频数据 - (0xAB 0xCD 0xEF 0xAB) + 0x02 + strlen(pcm纯音频数据) + pcm纯音频数据 - - 3)、注销包 - {"method":"destruction"} - - 样例:发送注销包 - (0xAB 0xCD 0xEF 0xAB) + 0x03 + strlen({"method":"destruction"} ) + {"method":"destruction"} - - 支持用ffmpeg推纯音频流接入流媒体服务器,支持的音频格式有(g711A、G711U、AAC、MP3) - 1、以rtsp协议推本地aac文件接入流媒体 - ffmpeg -re -stream_loop -1 -i F:\music\xxx.aac -c:a aac -rtsp_transport tcp -f rtsp rtsp://190.15.240.11:554/music/aac1 - - 2、以rtmp协议推本地aac文件接入流媒体 - ffmpeg -re -stream_loop -1 -i F:\music\xxx.aac -c:a aac -f flv rtmp://190.15.240.11:1935/music/aac2 - - 3、以rtsp协议推本地mp3文件接入流媒体 - ffmpeg -re -stream_loop -1 -i F:\music\xxx.mp3 -c:a mp3 -rtsp_transport tcp -f rtsp rtsp://190.15.240.11:554/music/aac3 - - 4、以rtmp协议推本地mp3文件接入流媒体 - ffmpeg -re -stream_loop -1 -i F:\music\xxx.mp3 -c:a mp3 -f flv rtmp://190.15.240.11:1935/music/aac4 - - 5、以rtsp协议推本地mp4文件中的纯音频流接入服务器 - 1) 比如推一个视频格式为h264,音频为aac的mp4文件中的音频流进入服务器,那么服务器接收到的音频流为aac ,视频不做推送 - ffmpeg -re -stream_loop -1 -i F:\video\H264_AAC_2021-02-10_1080P.mp4 -vn -acodec copy -rtsp_transport tcp -f rtsp rtsp://44.35.33.39:554/music/aac5 - - 2) 比如推一个视频格式为h264,音频为g711A的mp4文件中的音频流进入服务器,那么服务器接收到的音频流为g711A ,视频不做推送 - ffmpeg -re -stream_loop -1 -i F:\video\H264-G711A-92017.mp4 -vn -acodec copy -rtsp_transport tcp -f rtsp rtsp://44.35.33.39:554/music/aac6 - - 3) 比如推一个视频格式为h264,音频为g711U的mp4文件中的音频流进入服务器,那么服务器接收到的音频流为g711U ,视频不做推送 - ffmpeg -re -stream_loop -1 -i F:\video\H264-G711U-56434.mp4 -vn -acodec copy -rtsp_transport tcp -f rtsp rtsp://44.35.33.39:554/music/aac7 - - 网络协议媒体 输出: - 被动拉流输出 - 1、rtsp (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 2、rtmp (支持 视频:H264、H265 ,音频:AAC) - 3、GB28181码流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 4、http-flv (支持 视频:H264、H265 ,音频:AAC) - 5、http-hls (支持 视频:H264、H265 ,音频:AAC) - 6、http-mp4 (支持 视频:H264、H265 ,音频:AAC) - 7、websocket-flv (支持 视频:H264、H265 ,音频:AAC) - 8、webrtc (支持 视频:H264、H265 ,音频:G711A、G711U、OPUS) - 9、交通运输部jtt1078 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - - rtsp、rtmp、gb28181、jtt1078 主动推流输出: - 1、rtsp推流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 2、rtmp推流 (支持 视频:H264、H265 ,音频:AAC) - 3、GB28181推流 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - 4、交通运输部jtt1078 (支持 视频:H264、H265 ,音频:AAC、G711A、G711U) - - -三、简明使用例子 - 1) 首先要配置 ABLMediaServer.ini 里面的 本机的IP地址 localipAddress 、recordPath 项。 - - 1 本机的IP地址,最好需要配置准确(如果不配置程序会自动获取一个地址代替,如果本机有多个地址可能会不准确,如果配置则使用配置的IP地址,这样就准确), - 因为调用 getMediaList 获取可用媒体源的json中,会使用到本机的IP地址来拼接 rtsp、rtmp、http-flv、ws-flv、hls、http-mp4 的播放url 。 - 调用 getMediaList 返回的json串中有如下url子项: - "url": { - "rtsp": "rtsp://10.0.0.239:554/Media/Camera_00001", - "rtmp": "rtmp://10.0.0.239:1935/Media/Camera_00001", - "http-flv": "http://10.0.0.239:8088/Media/Camera_00001.flv", - "ws-flv": "ws://10.0.0.239:6088/Media/Camera_00001.flv", - "http-mp4": "http://10.0.0.239:5088/Media/Camera_00001.mp4", - "http-hls": "http://10.0.0.239:9088/Media/Camera_00001.m3u8" - } - - 其中的 10.0.0.239 就是可以从 localipAddress 配置项 精确获取 。 - - 2、录像路径配置 recordPath,如果不需要录像,可以忽略录像路径配置 - # 录像文件保存路径,如果不配置录像文件保存在应用程序所在的路径下的record子路径,如果配置路径则保存在配置的路径的record里面 - # 注意:如果需要录像存储,存储的硬盘千万不要分区,整个硬盘作为一个区,因为服务器没有执行两个以上的盘符操作。 - # 录像保存路径配置 windows平台的路径配置 比如 D:\video ,Linux 平台配置 /home/video - # 录像路径使用了默认路径,就一直使用默认路径,如果使用了配置路径就一直使用配置路径,确保使用的路径的硬盘空间为最大的,如果需要更换路径,要把原来的录像路径的视频全部删除。 - # 1路高清5M的摄像头,如果录像的话,每小时产生2G大小左右的录像文件。可以根据这个来计算需要购买多大的硬盘,接入多少路摄像头,需要设置录像文件最大的保存时间 - - 2)、 媒体输出规则: [network protocol]://[ip]:[port]/[app]/[stream][.extend] - - 【注:如果自己不想拼接播放url ,可以调用http函数 /index/api/getMediaList,返回可播放媒 - 体源中有各种播放协议的url, 详见下面的函数 /index/api/getMediaList 】 - - 说明: - [network protocol] 有 rtsp、rtmp、http、ws - [ip] 就是服务器所在的IP地址 - [port] 各个网络协议分享时设置的端口号,详见 ABLMediaServer.ini 的配置文件,里面有相应的网络协议配置端口 - [app] 各种网络协议发送过来设置的一级名字 - [stream] 各种网络协议发送过来设置的二级名字 - [.extend] 扩展名字,主要为为了访问服务器时,服务器需要识别网络协议需要客户端发送过来的扩展名。 - rtsp、rtmp 不需要扩展名, - http-flv 、ws-flv 扩展名为 .flv - hls 方式访问时, 扩展名为 .m3u8 - http-mp4访问时 扩展名为 .mp4 - - 比如服务器IP为 190.15.240.11 ,app 为 Media ,stream 为 Camera_00001 ,假定端口都是默认 ,那么各种网络访问url如下: - rtsp: - rtsp://190.15.240.11:554/Media/Camera_00001 - - rtmp: - rtmp://190.15.240.11:1935/Media/Camera_00001 - - http-flv: - http://190.15.240.11:8088/Media/Camera_00001.flv - - http-mp4: - http://190.15.240.11:5088/Media/Camera_00001.mp4 - - websocket-flv: - ws://190.15.240.11:6088/Media/Camera_00001.flv - - http-hls: - http://190.15.240.11:9088/Media/Camera_00001.m3u8 - - 3)、使用ffmpeg往 ABLMediaServer 推送rtsp 码流 【假定 源摄像机rtsp RUL为 rtsp://admin:abldyjh2020@192.168.1.120:554 , ABLMediaServer 所在服务器地址为 190.15.240.11 】 - 【推送rtsp方式说明:视频支持 H264、H265 ,音频支持AAC、G711A、G711U 】 - - ffmpeg -rtsp_transport tcp -i rtsp://admin:abldyjh2020@192.168.1.120:554 -vcodec copy -acodec copy -f rtsp -rtsp_transport tcp rtsp://190.15.240.11:554/Media/Camera_00001 - - 媒体输出: - rtsp: 【rtsp输出格式说明:视频支持 H264、H265 ,音频支持AAC、G711A、G711U 】 - rtsp://190.15.240.11:554/Media/Camera_00001 - - rtmp: 【rtmp输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - rtmp://190.15.240.11:1935/Media/Camera_00001 - - http-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:8088/Media/Camera_00001.flv - - ws-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - ws://190.15.240.11:6088/Media/Camera_00001.flv - - http-hls: 【http-hls输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:9088/Media/Camera_00001.m3u8 - - 4)、使用ffmpeg往 ABLMediaServer 推送rtmp 码流 【假定 源摄像机rtsp RUL为 rtsp://admin:abldyjh2020@192.168.1.120:554 , ABLMediaServer 所在服务器地址为 190.15.240.11 】 - 【推送rtmp方式说明:视频支持 H264 ,音频支持AAC 】 - - ffmpeg -rtsp_transport tcp -i rtsp://admin:abldyjh2020@192.168.1.120:554 -acodec copy -vcodec copy -f flv rtmp://190.15.240.11:1935/Media/Camera_00001 - - rtsp: 【rtsp输出格式说明:视频支持 H264、H265 ,音频支持AAC、G711A、G711U 】 - rtsp://190.15.240.11:554/Media/Camera_00001 - - rtmp: 【rtmp输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - rtmp://190.15.240.11:1935/Media/Camera_00001 - - http-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:8088/Media/Camera_00001.flv - - ws-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - ws://190.15.240.11:6088/Media/Camera_00001.flv - - http-hls: 【http-hls输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:9088/Media/Camera_00001.m3u8 - - 5)、使用ffmpeg往 ABLMediaServer 推送rtsp的文件码流 【假定媒体文件为:F:\video\MP4有声音\H264_AAC_2021-02-10_1080P.mp4 , ABLMediaServer 所在服务器地址为 190.15.240.11 】 - 【推送rtsp方式说明:视频支持 H264、H265 ,音频支持AAC、G711A、G711U 】 - - ffmpeg -re -stream_loop -1 -i F:\video\MP4有声音\H264_AAC_2021-02-10_1080P.mp4 -vcodec copy -acodec copy -rtsp_transport tcp -f rtsp rtsp://190.15.240.11:554/Media/Camera_00001 - - 媒体输出: - rtsp: 【rtsp输出格式说明:视频支持 H264、H265 ,音频支持AAC、G711A、G711U 】 - rtsp://190.15.240.11:554/Media/Camera_00001 - - rtmp: 【rtmp输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - rtmp://190.15.240.11:1935/Media/Camera_00001 - - http-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:8088/Media/Camera_00001.flv - - ws-flv: 【http-flv输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - ws://190.15.240.11:6088/Media/Camera_00001.flv - - http-hls: 【http-hls输出格式说明:视频支持 H264、H265 ,音频支持AAC 】 - http://190.15.240.11:9088/Media/Camera_00001.m3u8 - - 【特别注明:可以往10000 的udp端口推送TS码流,推送成功后,可以调用 http函数getMediaList来获取接入的rtp码流 】 - ffmpeg.exe -re -stream_loop -1 -i F:\video\H264_20191021094432.mp4 -vcodec copy -f rtp_mpegts rtp://127.0.0.1:100000 - - - 6)、流媒体输出播放验证 - 如果视频是rtsp方式,可以采用VLC进行播放验证  -     如果rtmp、http-flv 协议,视频为h264 ,可以采用VLC播放验证、或者B站的 flv.js 播放器验证 - 如果rtmp、http-flv 协议,视频为h265 ,可以采用EasyPlayer.js 播放器验证,【注:VLC 、flv.js 不支持Rtmp的H265视频、也不支持http-flv的265视频 】 - - 7)、申请代理rtsp、rtmp、flv 拉流 、本地mp4文件 ,申请删除代理拉流 - 1) 申请代理rtsp、rtmp、flv 拉流、本地mp4文件 - - URL: /index/api/addStreamProxy - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 Media - stream 媒体流名 比如 Camera_00001 【/app/stream 组合起来不能重复】 - url 代理拉流url 比如 rtsp://admin:abldyjh2020@192.168.1.120:554 或者 - rtmp://190.15.240.36:1935/Media/Camera_00001 或者 - http://190.15.240.36:8088/Media/Camera_00001.flv 或者 - d:\\video\\xxxx.mp4 (windows平台) - /home/video/xxxx.mp4 (Linux平台) - isRtspRecordURL 代理拉流的url是否是rtsp录像回放的url 默认0 ,1 是【可选参数】,如果是rtsp录像回放的url,可以进行控制代理拉流,比如 暂停、继续、控制倍速播放,拖动播放等等 ,参考 - 函数 /index/api/controlStreamProxy - optionsHeartbeat options心跳 options 命令作为心跳包 【可选参数】 代理rtsp拉流成后,是否开启发送 0 不开启, 1 开启 ,默认不开启,如果从 ZLMediaKit 拉取rtsp流,建议设置为 1 - enable_mp4 是否录像 1 录像,0 不录像 【可选参数】 - enable_hls 是否hls切片 1 进行hls 切片 ,0 不切片 【可选参数】 - convertOutWidth 转码宽 转码输出宽 如果指定宽、高 【可选参数】[1920 x 1080, 1280 x 720 ,960 x 640 ,800 x 480 ,720 x 576 , 720 x 480 ,640 x 480 ,352 x 288 ] 就说明 H265 进行转码为 H264 - convertOutHeight 转码高 转码输出高 如果指定宽、高 【可选参数】[1920 x 1080, 1280 x 720 ,960 x 640 ,800 x 480 ,720 x 576 , 720 x 480 ,640 x 480 ,352 x 288 ] 就说明 H265 进行转码为 H264 - H264DecodeEncode_enable H264是否解码 H264分辨率高再编码降分辨率,【可选参数】有时候需要H264视频进行先解码再重新编码降低分辨率,可以设置 H264DecodeEncode_enable 为 1 ,降下来的分辨率为 convertOutWidth 、 convertOutHeight - disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - - http GET 方式 - 1 请求rtsp拉流样例 - http://190.15.240.11:7088/index/api/addStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=Media&stream=Camera_00001&url=rtsp://admin:abldyjh2020@192.168.1.120:554&enable_mp4=0 - - http POST 方式 - 1 请求rtsp拉流样例 - http请求 url 样例 - http://190.15.240.11:7088/index/api/addStreamProxy - body 参数 , json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","url":"rtsp://admin:abldyjh2020@192.168.1.120:554","enable_mp4":0} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 - "key": 93 # 成功时返回大于0的值,为代理拉流的Key ,删除代理拉流时需要用的 - } - - 2) 控制代理拉流,比如 暂停、继续、控制倍速播放,拖动播放等等 - URL: /index/api/controlStreamProxy - - 参数: - secret 服务器密码 ,比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 比如 93 ,调用 addStreamProxy 返回的 key 的值 - command 比如 pause、resume、seek、scale 对于对应意思:暂停、继续、拖动播放、倍速播放 - value (字符串) 比如 1、2、4、8、16(倍速播放) ,npt方式:360、1800、3600(拖动播放),clock方式:clock=20230625T113000Z-19700101T000001Z(拖动到:2023-06-25 11:30:00执行播放) - value 为可选参数,当 command 为 pause,resume 时,value 不用 ,当 command 为seek,sacale - 是,需要填写value的值 - 命令、值样例列表 - command value 注释 - pause 不需要 暂停回放 - resume 不需要 继续回放 - scale 2 2倍速回放 - seek 360 拖拽从开始点计算起到360秒处再回放 【ntp方式拖拽 ,代表 华为 VCN\3800 】 - seek clock=20230625T113000Z-19700101T000001Z 拖拽到20230625T113000Z处再回放 【clock方式拖拽 ,代表 海康NVR 】 - - http GET 方式 - http://190.15.240.11:7088/index/api/controlStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93&command=pause 暂停 - http://190.15.240.11:7088/index/api/controlStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93&command=resume 继续 - http://190.15.240.11:7088/index/api/controlStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93&command=scale&value=2 2倍速回放 - http://190.15.240.11:7088/index/api/controlStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93&command=seek&value=360 拖拽到360秒处继续回放 - http://190.15.240.11:7088/index/api/controlStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93&command=seek&value=clock=20230625T113000Z-19700101T000001Z - - http POST 方式 - http URL : - http://190.15.240.11:7088/index/api/controlStreamProxy - - body 参数 Json格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93,"command":"pause"} - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93,"command":"resume"} - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93,"command":"sacale","value":"2"} - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93,"command":"seek","value":"360"} - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93,"command":"seek","value":"clock=20230625T113000Z-19700101T000001Z"} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 【注:发送http请求 可以使用curl、postman、或者其他标准的http工具 】 - - - 3) 申请删除代理rtsp、rtmp、flv 拉流 - URL: /index/api/delStreamProxy - - 参数: - secret 服务器密码 ,比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 比如 93 ,调用 addStreamProxy 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/delStreamProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL : - http://190.15.240.11:7088/index/api/delStreamProxy - - body 参数 Json格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 【注:发送http请求 可以使用curl、postman、或者其他标准的http工具 】 - - - - 8)、申请代理rtsp、rtmp、推流 、申请删除代理拉流 - 1) 申请代理rtsp、rtmp 推流(注意:不是国标GB28181推流) - - URL: /index/api/addPushProxy - - 参数: 参数说明 参考值 - secret 服务器密码 , 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 Media - stream 媒体流名 比如 Camera_00001 - url 代理推流url 比如 rtsp://190.15.240.36:554/Media/Camera_00001 或者 rtmp://190.15.240.36:1935/Media/Camera_00001 - disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - - http GET 方式 - http://190.15.240.11:7088/index/api/addPushProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=Media&stream=Camera_00001&url=rtsp://190.15.240.36:554/Media/Camera_00001 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/addPushProxy - - http Body 参数 (json格式) - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","url":"rtsp://190.15.240.36:554/Media/Camera_00001"} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 - "key": 93 # 成功时返回大于0的值,为代理推流的Key ,删除代理推流时需要用的 - } - - 2) 申请删除代理rtsp、rtmp 推流 - URL: /index/api/delPushProxy - - 参数: 参数说明 参数参考值 - secret 服务器密码 , 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键ID 比如 93 ,调用 /index/api/addPushProxy 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/delPushProxy?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/delPushProxy - - http Body json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 9)、创建GB28181\Jtt1078接收端口、删除GB28181\Jtt1078接收端口、国标暂停、继续 - - 1 创建GB28181\Jtt1078接收端口 - - URL: /index/api/openRtpServer - 功能: - 创建GB28181\Jtt1078接收端口,如果该端口接收超时,会自动回收,不用调用 /index/api/closeRtpServer - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 gb28181 、rtp 等等 (接入) - stream_id 媒体流名 比如 44030012343220234234 (最好是国标编号)( 接入 ) - payload PS负载值 国标SDP里面PS负载值 ,比如 96,98 ,108 ,一定要从国标SDP里面获取 - port 端口号 0 ,由服务器自动分配,别的值 比如 26324 为指定端口 - enable_tcp 是否为tcp 0 为 udp , 1 为tcp被动方式 ,2 为tcp主动连接方式 - dst_url 目标IP 目标IP地址 【可选参数 ,当 enable_tcp 为 2 时必须填写 】 - dst_port 目标端口 目标端口 【可选参数 ,当 enable_tcp 为 2 时必须填写】 - - enable_mp4 是否录像 1 录像,0 不录像 【可选参数】 - enable_hls 是否hls切片 1 进行hls 切片 ,0 不切片 【可选参数】 - convertOutWidth 转码宽 转码输出宽 如果指定宽、高 【可选参数】[1920 x 1080, 1280 x 720 ,960 x 640 ,800 x 480 ,720 x 576 , 720 x 480 ,640 x 480 ,352 x 288 ] 就说明 H265 进行转码为 H264 - convertOutHeight 转码高 转码输出高 如果指定宽、高 【可选参数】[1920 x 1080, 1280 x 720 ,960 x 640 ,800 x 480 ,720 x 576 , 720 x 480 ,640 x 480 ,352 x 288 ] 就说明 H265 进行转码为 H264 - H264DecodeEncode_enable H264是否解码 H264分辨率高再编码降分辨率,【可选参数】有时候需要H264视频进行先解码再重新编码降低分辨率,可以设置 H264DecodeEncode_enable 为 1 ,降下来的分辨率为 convertOutWidth 、 convertOutHeight - RtpPayloadDataType rtp打包数据格式 rtp打包数据格式 【可选参数 ,默认 1 】 [1 PS 国标gb28181 ]、[ 2 ES 视频支持 H246\H265,音频只支持G711A、G711U ]、[3 XHB (一家公司的打包格式) 只支持视频,音频不能加入打包 ] [ 4 、Jt1078(2016版本)码流接入 ] - disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - jtt1078_version 指定1078版本号 2013、2016、2019 【可选参数】 2013 指定为 2013版本 、2016 指定为 2016版本、 2019 指定为 2019 版本 - - send_app 应用名 比如 gb28181 、rtp 等等 【可选参数】 用于把本服务器的码流(send_app/send_stream_id)回复给发送端 - send_stream_id 媒体流名 比如 44030012343220234234 【可选参数】 用于把本服务器的码流(send_app/send_stream_id)回复给发送端 - send_disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - send_disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - detectSendAppStream 是否检测发送流ID 0 不检测 ,1 检测 【可选参数】 默认 1 在需要回传码流时,事先检测 send_app、send_stream_id 是否存在。0 不检测,先打开接收成功后,稍后再把send_app、send_stream_id接入流媒体,openRtpServer函数自动回复给下级流媒体。 - - http GET 方式 - http://190.15.240.11:7088/index/api/openRtpServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=gb28181&stream_id=44030012343220234234&payload=96&port=0&enable_tcp=0&enable_mp4=0 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/openRtpServer - - http 参数值 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream_id":"Camera_00001","payload":96,"port":0,"enable_tcp":0,"enable_mp4":0} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "port": 8356, # 端口号 - "memo": "success", # success 为成功 - "key": 93 # 成功时返回大于0的值,GB28181接收实例key ,关闭时需要 - } - - 2 删除 GB28181\Jtt1078接收端口 - URL: /index/api/closeRtpServer - 功能: - 删除GB28181\Jtt1078接收端口 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/openRtpServer 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/closeRtpServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/closeRtpServer - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 3 暂停 GB28181\Jtt1078接收端口,只是不检测接收端口是否有码流进入。 - URL: /index/api/pauseRtpServer - 功能: - 暂停GB28181\Jtt1078接收 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/openRtpServer 返回的 key 的值 - - http GET 方式 - http://44.35.33.249:7088/index/api/pauseRtpServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=588 - - http POST 方式 - http URL - http://44.35.33.249:7088/index/api/pauseRtpServer - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":588} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 4 继续 GB28181\Jtt1078接收端口,开启检测端口是否有码流到达,如果时长到达最大超时没有码流进入会立即删除接收端口 - URL: /index/api/resumeRtpServer - 功能: - 继续GB28181\Jtt1078接收 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/openRtpServer 返回的 key 的值 - - http GET 方式 - http://44.35.33.249:7088/index/api/resumeRtpServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=588 - - http POST 方式 - http URL - http://44.35.33.249:7088/index/api/resumeRtpServer - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":588} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 10)、创建GB28181\Jtt1078 发送端口、删除GB28181\Jtt1078发送端口 - - 1 创建GB28181\Jtt1078发送端口 - - URL: /index/api/startSendRtp - 功能: - 创建GB28181\Jtt1078发送端口,如果该发送端端口没有数据发送,会自动回收,不用调用 /index/api/stopSendRtp - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 gb28181 、rtp 等等 (发送出去) - stream 媒体流名 比如 44030012343220234234 (发送出去) - payload PS负载值 国标SDP里面PS负载值 ,比如 96,98 ,108 ,rtp打包时需要 - ssrc 同步源 ssrc - src_port 发送端绑定的端口号 指定服务器在发送国标流时绑定的端口号,如果为 0 ,由服务器自动分配,别的值 比如 26324 为指定端口 - dst_url 目标IP 目标IP地址 - dst_port 目标端口 目标端口 - is_udp 是否设置udp 0 TCP主动方式,1 udp 方式 ,2 为 TCP 被动方式 - RtpPayloadDataType rtp打包数据格式 【可选参数 ,默认 1 】 [ 1 PS 国标gb28181 ]、[ 2 ES 视频支持 H246\H265,音频只支持G711A、G711U ]、[3 XHB (一家公司的打包格式) 只支持视频,音频不能加入打包 ] [ 4 、Jt1078(2016版本)码流发送 ] - disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - jtt1078_version 指定1078版本号 2013、2016、2019 【可选参数】 2013 指定为 2013版本 、2016 指定为 2016版本、 2019 指定为 2019 版本 - - recv_app 应用名 比如 gb28181 、rtp 等等 【可选参数】 接入进来 通过在发送的连接中接收进来的码流 - recv_stream 媒体流名 比如 44030012343220234234 【可选参数】 接入进来 通过在发送的连接中接收进来的码流 - recv_disableVideo 是否过滤掉视频 0 不过滤 ,1 过滤视频 【可选参数】 默认 0 不过滤视频,国家电网协议中需要摄像头和摄像头直接需要对接,摄像头推上来的媒体流中过滤掉视频(disableVideo=1)再发给对方才能完成对讲 - recv_disableAudio 是否过滤掉音频 0 不过滤 ,1 过滤音频 【可选参数】 默认 0 不过滤音频,有时候不需要音频、或者由于敏感原因禁止收听音频,可以过滤掉音频流接入流媒体服务器,只需要设置 disableAudio = 1即可过滤音频 - - http GET 方式 - http://190.15.240.11:7088/index/api/startSendRtp?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=gb28181&stream=44030012343220234234&payload=96&ssrc=5224&src_port=26324&dst_url=190.15.240.11&dst_port=9824&is_udp=1 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/startSendRtp - - http 参数值 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","payload":96,"ssrc":2432,"src_port":26324,"dst_url":"190.15.240.11","dst_port":9824,"is_udp":1} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "port": 8356, # 端口号 - "memo": "success", # success 为成功 - "key": 93 # 成功时返回大于0的值,GB28181发送码流实例key ,关闭时需要 - } - - 2 删除 GB28181\Jtt1078发送端口 - URL: /index/api/stopSendRtp - 功能: - 删除GB28181\Jtt1078发送端口 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/startSendRtp 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/stopSendRtp?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/stopSendRtp - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 11)、获取流媒体服务器所有可用的媒体源 - URL: /index/api/getMediaList - - 功能: - 获取流媒体服务器所有媒体源 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【可选参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【可选参数】 - - 参数填写样例说明: - 样例1(app、stream 都不填写) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - - 返回所有在线的媒体源 - - 样例2 (只填写 app ) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - app rtp - 返回 app 等于 rtp 的所有媒体源 - - 样例3 (填写 app = rtp , stream = 44303403343034243200234) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - app rtp - stream 44303403343034243200234 - 返回 app 等于 rtp、并且 stream 等于 44303403343034243200234 的所有媒体源 - - 样例4 (填写 stream = 44303403343034243200234) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - stream 44303403343034243200234 - 返回 stream 等于 44303403343034243200234 的所有媒体源 - - http GET 方式 - http://127.0.0.1:7088/index/api/getMediaList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/getMediaList - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "memo": "success", - "mediaList": [ - { - "key": 34, - "app": "Media", - "stream": "Camera_00001", - "sim": "123456789123", 【1078码流接入这个字段的值不会为空,代表设备的sim卡编码 】 - "status": false , 【 false 尚未录像,true 正在录像 】 - "enable_hls": false, 【 false 尚未启用,true 启用hls回放 】 - "transcodingStatus": false, 【 false 尚未转码,true 正在转码 】 - "sourceURL": "rtsp://10.0.0.239:554/Media/Camera_00001", - "sourceType": 23, - "readerCount": 0, - "videoCodec": "H264", - "width": 1920, - "height": 1080, - "networkType": 24, - "audioCodec": "AAC", - "audioChannels": 1, - "audioSampleRate": 16000, - "url": { - "rtsp": "rtsp://10.0.0.239:554/Media/Camera_00001", - "rtmp": "rtmp://10.0.0.239:1935/Media/Camera_00001", - "http-flv": "http://10.0.0.239:8088/Media/Camera_00001.flv", - "ws-flv": "ws://10.0.0.239:6088/Media/Camera_00001.flv", - "http-mp4": "http://10.0.0.239:5088/Media/Camera_00001.mp4", - "http-hls": "http://10.0.0.239:9088/Media/Camera_00001.m3u8", - "webrtc":"http://10.0.0.239:8892/webrtc-streamer.html?video=/Media/Camera_00001" - } - } - ] - } - - 【注释:可以根据 "networkType": 24, 这个字段值区分 媒体接入的类型 ,具体详见网络类型的对照表 】 - - 12) 删除 某一个媒体源 - URL: /index/api/delMediaStream - 功能: - 某一个媒体源,这媒体源,可以是rtp推流、rtmp推流,各种方式代理拉流接入的,国标接入 等等。 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/getMediaList 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/delMediaStream?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/delMediaStream - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 13)、获取流媒体服务器所有往外部输出码流列表,包括外部请求的rtsp、rtmp、http-flv、ws-flv、hls 列表 - 也包括服务器代理rtsp推流、rtmp推流列表 - 也包括服务器以国标方式往上级推rtp流列表 - 【必要时可以调用 /index/api/delOutList 接口删除某一个列表对象,比如删除某一路国标推流、删除某一路rtsp推流、 删除某一路rtmp推流】 - URL: /index/api/getOutList - - 功能: - 获取流媒体服务器所有输出流列表 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http GET 方式 - http://44.35.33.239:7088/index/api/getOutList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://44.35.33.239:7088/index/api/getOutList - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "memo": "success", - "outList": [ - { - "key": 103, 【请求客户端的标识ID ,可以调用 /index/api/delOutList 删除 该请求】 - "app": "Media", - "stream": "Camera_00001", - "sourceURL": "rtsp://44.35.33.239:554/Media/Camera_00001", 【表示外界以rtsp方式向服务器请求码流】 - "videoCodec": "H264", - "audioCodec": "AAC", - "audioChannels": 1, - "audioSampleRate": 16000, - "networkType": 24, 【网络类型为24 ,标识为rtsp 方式】 - "dst_url": "44.35.33.39", 【 请求码流客户端IP 】 - "dst_port": 43801 【 请求码流客户端端口 】 - }, - { - "key": 85, 【请求客户端的标识ID ,可以调用 /index/api/delOutList 删除 该请求】 - "app": "Media", - "stream": "Camera_00001", - "sourceURL": "http://localhost:8088/Media/Camera_00001.flv",【表示外界以 http-flv 方式向服务器请求码流】 - "videoCodec": "H264", - "audioCodec": "AAC", - "audioChannels": 1, - "audioSampleRate": 16000, - "networkType": 25, 【网络类型为25 ,标识为 http-flv 方式】 - "dst_url": "44.35.33.39", 【 请求码流客户端IP 】 - "dst_port": 43806 【 请求码流客户端端口 】 - } - ] - } - - 【注释:可以根据 "networkType": 24, 这个字段值区分 媒体输出的类型 ,具体详见网络类型的对照表 】 - - 14) 删除 某一个服务器所有往外部输出码流列表 - URL: /index/api/delOutList - 功能: - 删除某一个流媒体服务器所有往外部输出码流列表,包括外部请求的rtsp、rtmp、http-flv、ws-flv、hls 点播 。国标推流、rtsp推流、rtmp 推流 等等 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - key 主键值ID 比如 93 , 调用 /index/api/getOutList 返回的 key 的值 - - http GET 方式 - http://190.15.240.11:7088/index/api/delOutList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=93 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/delOutList - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","key":93} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 ,如果失败是其他值 - } - - 15)根据条件组合,删除任意一个或一组或者全部媒体输入列表 - URL: /index/api/close_streams - - 功能 - 删除任意一个或一组或者全部媒体输入列表 - - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - app 应用名 比如 gb28181 、rtp 等等 【可选参数】 - stream 媒体流名 比如 Camera_00001、dsafdsafassdafadsfas、等等 【可选参数】 - force 是否强制关闭 1 强制关闭,不管是否有人在观看、0 非强制关闭,当有人观看时不关闭。 【必填参数】 - - http GET 方式 - 示例1: http://190.168.24.112:7088/index/api/close_streams?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&app=live&force=1 - 【表示强行关闭 app 等于 live 的码流接入】 - 示例2: http://190.168.24.112:7088/index/api/close_streams?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&app=live&stream=Camera_00001&force=1 - 【表示强行关闭 app 等于 live, 并且 stream 等于 Camera_00001 的码流接入 】 - 示例3: http://190.168.24.112:7088/index/api/close_streams?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&force=1 - 【表示强行关闭 所有码流(app全部、stream全部) 接入 】 - - http pos 方式 - 示例1: http URL: - http://190.168.24.112:7088/index/api/close_streams - body: - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","app":"live","force":1} - - 【表示强行关闭 app 等于 live 的码流接入】 - - 示例2: http URL: - http://190.168.24.112:7088/index/api/close_streams - body: - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","app":"live","stream":"Camera_00001","force":1} - - 【表示强行关闭 app 等于 live, 并且 stream 等于 Camera_00001 的码流接入 】 - - 示例3: http URL: - http://190.168.24.112:7088/index/api/close_streams - body: - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","force":1} - - 【 表示强行关闭 所有码流(app全部、stream全部) 接入 】 - - 16)、 开始录像、停止录像 - 1) 申请开始录像 - - URL: /index/api/startRecord - - 参数: 参数说明 参考值 - secret 服务器密码 ,比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 Media - stream 媒体流名 比如 Camera_00001 - - http GET 方式 - http://190.15.240.11:7088/index/api/startRecord?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=Media&stream=Camera_00001 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/startRecord - - http Body 参数 (json格式) - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001"} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "MediaSource: /Media/Camera_00001 start Record", # "code": 0 为成功 - } - - 2) 申请停止录像 - URL: /index/api/stopRecord - - 参数: 参数说明 参考值 - secret 服务器密码 ,比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - vhost 比如 _defaultVhost_ - app 应用名 比如 Media - stream 媒体流名 比如 Camera_00001 - - http GET 方式 - http://190.15.240.11:7088/index/api/stopRecord?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=Media&stream=Camera_00001 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/stopRecord - - http Body 参数 (json格式) - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001"} - - 返回Body: - { - "code": 0, # 0为操作成功,其他值为操作失败 - "memo": "success", # success 为成功 - } - - 17 获取系统配置参数 - URL: /index/api/getServerConfig - 功能: - 获取服务器的配置参数 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http GET 方式 - http://190.15.240.11:7088/index/api/getServerConfig?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/getServerConfig - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "params": [ - - { - "secret": "035c73f7-bb6b-4889-a715-d9eb2d1925cc", - "memo": "server password", - }, - { - "ServerIP": "44.35.33.239", - "memo": "ABLMediaServer ip address" - }, - { - "rtc.listening-ip": "192.168.2.5", - "memo": "Total number of video playback threads ." - }, - { - "mediaServerID": "ABLMediaServer_00001", - "memo": "media Server ID " - }, - { - "hook_enable": 0, - "memo": "hook_enable = 1 open notice , hook_enable = 0 close notice " - }, - { - "enable_audio": 1, - "memo": "enable_audio = 1 open Audio , enable_audio = 0 Close Audio " - }, - { - "httpServerPort": 7088, - "memo": "http api port " - }, - { - "rtspPort": 554, - "memo": "rtsp port " - }, - { - "rtmpPort": 1935, - "memo": "rtmp port " - }, - { - "httpFlvPort": 8088, - "memo": "http-flv port " - }, - { - "hls_enable": 0, - "memo": "hls whether enable " - }, - { - "hlsPort": 9088, - "memo": "hls port" - }, - { - "wsPort": 6088, - "memo": "websocket flv port" - }, - { - "mp4Port": 5088, - "memo": "http mp4 port" - }, - { - "ps_tsRecvPort": 10000, - "memo": "recv ts , ps Stream port " - }, - { - "hlsCutType": 2, - "memo": "hlsCutType = 1 hls cut to Harddisk,hlsCutType = 2 hls cut Media to memory" - }, - { - "h265CutType": 1, - "memo": " 1 h265 cut TS , 2 cut fmp4 " - }, - { - "RecvThreadCount": 128, - "memo": " RecvThreadCount " - }, - { - "SendThreadCount": 128, - "memo": "SendThreadCount" - }, - { - "GB28181RtpTCPHeadType": 2, - "memo": "rtp Length Type" - }, - { - "ReConnectingCount": 40320, - "memo": "Try reconnections times ." - }, - { - "maxTimeNoOneWatch": 9999999, - "memo": "maxTimeNoOneWatch ." - }, - { - "pushEnable_mp4": 0, - "memo": "pushEnable_mp4 ." - }, - { - "fileSecond": 180, - "memo": "fileSecond ." - }, - { - "fileKeepMaxTime": 1, - "memo": "fileKeepMaxTime ." - }, - { - "httpDownloadSpeed": 6, - "memo": "httpDownloadSpeed ." - }, - { - "RecordReplayThread": 32, - "memo": "Total number of video playback threads ." - } - ] - } - - 18)、查询录像列表 - URL: /index/api/queryRecordList - - 功能: - 查询某一路输入源的录像列表(可以查询代理拉流输入、推流输入、国标输入等等 ) - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【必填参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【必填参数】 - starttime 开始时间 比如 20220116154810 年月日时分秒 【必填参数】 - endtime 结束时间 比如 20220116155115 年月日时分秒 【必填参数】 - - 【注意:1、开始时间必须小于 当前时间减去切片时长的时间 2、从 开始时间 至 结束时间 不能超过3天】 - - http GET 方式 - http://10.0.0.239:7088/index/api/queryRecordList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&app=Media&stream=Camera_00001&starttime=20220116154810&endtime=20220116155115 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/queryRecordList - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","starttime":"20220116154810","endtime":"20220116155115"} - - 返回Body: - { - "code": 0, - "app": "Media", - "stream": "Camera_00001", - "starttime": "20220116154810", - "endtime": "20220116155115", - "recordFileList": [ - { - "file": "20220116154810.mp4", - "duration": 300, 当前录像时间长度,单位 秒 - "url": { - "rtsp": "rtsp://10.0.0.239:554/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810", - "rtmp": "rtmp://10.0.0.239:1935/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810", - "http-flv": "http://10.0.0.239:8088/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810.flv", - "ws-flv": "ws://10.0.0.239:6088/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810.flv", - "http-mp4": "http://10.0.0.239:5088/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810.mp4?download_speed=1", - "download": "http://10.0.0.239:5088/Media/Camera_00001__ReplayFMP4RecordFile__20220116154810.mp4?download_speed=6" - } - }, - { - "file": "20220116155110.mp4", - "duration": 256, 当前录像时间长度,单位 秒 - "url": { - "rtsp": "rtsp://10.0.0.239:554/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110", - "rtmp": "rtmp://10.0.0.239:1935/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110", - "http-flv": "http://10.0.0.239:8088/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110.flv", - "ws-flv": "ws://10.0.0.239:6088/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110.flv", - "http-mp4": "http://10.0.0.239:5088/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110.mp4?download_speed=1", - "download": "http://10.0.0.239:5088/Media/Camera_00001__ReplayFMP4RecordFile__20220116155110.mp4?download_speed=6" - } - } - ] - } - 19)、消息通知使用 - 功能说明:消息通知是流媒体服务器的一些消息比如无人观看、fmp4录像切片完成、播放时流地址不存在等等信息能及时的通知到另外一个http服务器上,需要此功能 - 消息通知功能用在什么地方,比如说无人观看消息通知,当收到无人观看消息时,国标服务器可以关闭国标发流,断开代理拉流,断开推流等等操作 - 要使用此功能把配置文件的参数hook_enable 值设置为 1,同时通知的http服务器地址、端口号一定要设置对,下面列举出配置文件中的相关参数 - - hook_enable=1 #事件通知部分,当 hook_enable=1 时,开启事件通知,hook_enable=0时关闭事件通知 - on_stream_arrive=http://10.0.0.238:7088/index/hook/on_stream_arrive #当某一路的码流达到时会通知一次 - on_stream_none_reader=http://10.0.0.238:8080/index/hook/on_stream_none_reader #当某一路流无人观看时,会触发该通知事件,接收端收到后可以进行断流操作 - on_stream_disconnect=http://10.0.0.238:7088/index/hook/on_stream_disconnect #当某一路码流断开时会通知一次 - on_stream_not_found=http://10.0.0.238:8080/index/hook/on_stream_not_found #播放时,找不到播放的码流,通过配合on_stream_none_reader事件可以完成按需拉流 - on_record_mp4=http://10.0.0.238:8080/index/hook/on_record_mp4 #录制完毕一段mp4文件通知 - - 【注:http url的 IP,端口 是代表消息接收服务器的IP,端口,一定要填写正确,url 地址要合法,不要有空格 】 - 1、当某一路码流到达时会发送通知: - POST /index/hook/on_stream_arrive HTTP/1.1 # 根据 /index/hook/on_stream_arrive 这个可以判断是某一路码流到达 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 105 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-5.2.9(2022-03-28) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - { - "app":"Media", # app - "stream":"Camera_00001", # stream - "mediaServerId":"ABLMediaServer_00001", # 流媒体服务器编号 ,在配置文件可以配置,如果集群流媒体服务器时,可以给每台流媒体服务器起个编号 - "networkType":23, # 媒体流来源网络编号,可参考附表 - "key":130, # 媒体流来源编号,可以根据这个key进行关闭流媒体 可以调用delMediaStream或close_streams 函数进行关闭 - "status":true, - "enable_hls":false, - "transcodingStatus":false, - "sourceURL":"rtsp://admin:abldyjh2020@44.35.33.248:554", - "readerCount":0, - "noneReaderDuration":0, - "videoCodec":"H265", - "videoFrameSpeed":25, - "width":1920, - "height":1080, - "videoBitrate":0, - "audioCodec":"AAC", - "audioChannels":1, - "audioSampleRate":8000, - "audioBitrate":0, - "url": - { - "rtsp":"rtsp://44.35.33.249:554/Media/Camera_00001", - "rtmp":"rtmp://44.35.33.249:1935/Media/Camera_00001", - "http-flv":"http://44.35.33.249:8088/Media/Camera_00001.flv", - "ws-flv":"ws://44.35.33.249:6088/Media/Camera_00001.flv", - "http-mp4":"http://44.35.33.249:5088/Media/Camera_00001.mp4", - "http-hls":"http://44.35.33.249:9088/Media/Camera_00001.m3u8" - } - } - - 2、无人观看消息通知样例: - POST /index/hook/on_stream_none_reader HTTP/1.1 # 根据 /index/hook/on_stream_none_reader 这个可以判断是无人观看消息通知 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 105 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-5.2.9(2022-03-28) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - { - "app":"Media", # app - "stream":"Camera_00001", # stream - "mediaServerId":"ABLMediaServer_00001", # 流媒体服务器编号 ,在配置文件可以配置,如果集群流媒体服务器时,可以给每台流媒体服务器起个编号 - "networkType":23, # 媒体流来源网络编号,可参考附表 - "key":130 # 媒体流来源编号,可以根据这个key进行关闭流媒体 可以调用delMediaStream或close_streams 函数进行关闭 - } - - 3、 fmp4录像切片录像完成一个文件时会发送一个消息通知 - POST /index/hook/on_record_mp4 HTTP/1.1 # 根据 /index/hook/on_record_mp4 这个可以判断是mp4录像切片完毕一个通知 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 127 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-5.2.9(2022-03-28) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - { - "app":"Media", # app - "stream":"Camera_00001", # stream - "mediaServerId":"ABLMediaServer_00001", # 流媒体服务器编号 ,在配置文件可以配置,如果集群流媒体服务器时,可以给每台流媒体服务器起个编号 - "networkType":70, # 媒体流来源网络编号,可参考附表 - "fileName":"20220312212546.mp4" # 录像切片完成的文件名字 - } - - 4、当某一路码流断开时会发送通知: - POST /index/hook/on_stream_disconnect HTTP/1.1 # 根据 /index/hook/on_stream_disconnect 这个可以判断是某一路码流断开 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 105 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-5.2.9(2022-03-28) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - { - "app":"Media", # app - "stream":"Camera_00001", # stream - "mediaServerId":"ABLMediaServer_00001", # 流媒体服务器编号 ,在配置文件可以配置,如果集群流媒体服务器时,可以给每台流媒体服务器起个编号 - "networkType":23, # 媒体流来源网络编号,可参考附表 - "key":130 # 媒体流来源编号,可以根据这个key进行关闭流媒体 可以调用delMediaStream或close_streams 函数进行关闭 - } - - 5、 当播放一个url,如果不存在时,会发出一个消息通知 - POST /index/hook/on_stream_not_found HTTP/1.1 # 根据 /index/hook/on_stream_not_found ,Http接收服务器得知流不不存在 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 127 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-5.2.9(2022-03-28) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - { - "app":"Media", # app 不存在的app - "stream":"Camera_00001", # stream 不存在的stream - "mediaServerId":"ABLMediaServer_00001" # 流媒体服务器编号 ,在配置文件可以配置,如果集群流媒体服务器时,可以给每台流媒体服务器起个编号 - } - 6、ABLMediaServer启动时会发送上线通知 - POST /index/hook/on_server_started HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 105 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"localipAddress":"44.35.33.249","mediaServerId":"ABLMediaServer_00001","datetime":"2023-04-18 10:04:37"} - - 7、某一个码流接入流媒体服务器时会产生 发布 事件通知 - POST /index/hook/on_publish HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 149 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"app":"Media","stream":"Camera_00001","mediaServerId":"ABLMediaServer_00001","networkType":50,"key":470,"ip":"44.35.33.248" ,"port":554,"params":""} - - 8、当播放流媒体服务器里面某一个码流时,会触发 播放事件 ,可以通知 parmas 参数值进行播放鉴权 - POST /index/hook/on_play HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 135 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"app":"Media","stream":"Camera_00001","mediaServerId":"ABLMediaServer_00001","networkType":30,"key":472,"ip":"" ,"port":0,"params":"user=admin&password=safsa234234&token=@#$@#$@#ASDFasfdsa@#$23"} - - 9、如果某一个码流进行MP4录像(enable_mp4=1),会触发录像进度通知事件 - POST /index/hook/on_record_progress HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 204 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"app":"Media","stream":"Camera_00001","mediaServerId":"ABLMediaServer_00001","networkType":472,"key":470,"fileName":"20230418100440.mp4","currentFileDuration":49,"TotalVideoDuration":49} - - 10、如果某一个码流开启hls(enable_hls=1)并且设置为切片到硬盘(hlsCutType=1 在配置文件中) ,每当切片完成一个ts文件会触发该事件 - POST /index/hook/on_record_ts HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 246 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"app":"Media","stream":"Camera_00001","mediaServerId":"ABLMediaServer_00001","networkType":30,"key":470,"createDateTime":"2023-04-18 10:05:47","currentFileDuration":3,"fileName":"D:\WorkDir\ABLMediaServer\x64\Debug\www\Media\Camera_00001\23.ts"} - - 11、流媒体服务器每隔60秒会触发心跳事件通知 - POST /index/hook/on_server_keepalive HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 105 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"localipAddress":"44.35.33.249","mediaServerId":"ABLMediaServer_00001","datetime":"2023-04-18 10:25:40"} - - 12、当代理拉流、国标接入等等 码流不到达时会发出 码流不到达的事件通知 - POST /index/hook/on_stream_not_arrive HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 155 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"mediaServerId":"ABLMediaServer_00001","app":"gb28181","stream":"440300123432202342349","networkType":60,"key":470} - - 13、如果某一个码流进行MP4录像(enable_mp4=1),当某个MP4文件被删除会触发该事件通知 - POST /index/hook/on_delete_record_mp4 HTTP/1.1 - Accept: */* - Accept-Language: zh-CN,zh;q=0.8 - Connection: keep-alive - Content-Length: 204 - Content-Type: application/json - Host: 127.0.0.1 - Tools: ABLMediaServer-6.3.5(2023-04-30) - User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 - - {"app":"Media","stream":"Camera_00001","mediaServerId":"ABLMediaServer_00001","fileName":"20230418100440.mp4"} - - - - 20) 图片抓拍 - URL: /index/api/getSnap - - 功能: - 查询某一接入的媒体源进行抓拍 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【必填参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【必填参数】 - timeout_sec 超时时长 10 即本次抓拍最大超时时长 单位 秒 【必填参数】 - - http GET 方式 - http://127.0.0.1:7088/index/api/getSnap?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&vhost=_defaultVhost_&app=Media&stream=Camera_00001&timeout_sec=10 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/getSnap - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","timeout_sec":10} - - 抓拍成功返回: - { - "code": 0, - "memo": "success , Catpuring takes time 219 millisecond .", - "url": "http://10.0.0.239:7088/Media/Camera_00001/2022031910034501.jpg" - } - - 21)图片列表查询 - URL: /index/api/queryPictureList - - 功能: - 查询某一路输入源的抓拍图片列表 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【必填参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【必填参数】 - starttime 开始时间 比如 20220317081201 年月日时分秒 【必填参数】 - endtime 结束时间 比如 20220319231201 年月日时分秒 【必填参数】 - - 【注意:1、开始时间必须小于 当前时间减去切片时长的时间 2、从 开始时间 至 结束时间 不能超过7天】 - - http GET 方式 - http://10.0.0.239:7088/index/api/queryPictureList?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&app=Media&stream=Camera_00001&starttime=20220317081201&endtime=20220319231201 - - http POST 方式 - http URL - http://190.15.240.11:7088/index/api/queryPictureList - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","vhost":"_defaultVhost_","app":"Media","stream":"Camera_00001","starttime":"20220317081201","endtime":"20220319231201"} - - 成功返回Body值 - { - "code": 0, - "app": "Media", - "stream": "Camera_00001", - "starttime": "20220317081201", - "endtime": "20220319231201", - "PictureFileList": [ - { - "file": "2022031816153857.jpg", - "url": "http://10.0.0.239:7088/Media/Camera_00001/2022031816153857.jpg" - }, - { - "file": "2022031816153958.jpg", - "url": "http://10.0.0.239:7088/Media/Camera_00001/2022031816153958.jpg" - }, - { - "file": "2022031816154059.jpg", - "url": "http://10.0.0.239:7088/Media/Camera_00001/2022031816154059.jpg" - }, - ] - } - - 22、修改某一路的水印相关参数 - - URL: index/api/setTransFilter - - 功能: - 修改某一路的水印相关参数,比水印的内容、颜色、字体大小、字体位置、字体透明度 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【必填参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【必填参数】 - text 水印内容 比如 某某市某某公安局 【必填参数】 - size 字体大小 20、30 、40 、50 【必填参数】 - color 字体颜色 red,green,blue,white,black, - alpha 透明度 0.1 ~ 0.9 , - left 水印x坐标 比如 5 、 10 、20 - top 水印y坐标 比如 5 、 10 、 20 - trans 是否转换 固定为 1 - - http POST 方式 - http://127.0.0.1:7088/index/api/setTransFilter - - Body 参数内容为 - { - "secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc", - "app" : "live", - "stream" : "test", - "text" : "ABL", - "size" : 60, - "color" : "red", - "alpha" : 0.8, - "left" : 40, - "top" : 40, - "trans" : 1 - } - - 23、为了功能更新的需要,增加设置参数值的接口,可以单独设置 ABLMediaServer.ini 的某一个值,并且服务器不用重启,立即起效 - - URL: index/api/setConfigParamValue - - 功能: - 为了功能更新的需要,增加设置参数值的接口,可以单独设置 ABLMediaServer.ini 的某一个值,并且服务器不用重启,立即起效 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - vhost 比如 _defaultVhost_ 【可选参数】 - key 参数名 比如 saveGB28181Rtp (保存接入的国标PS流)、 saveProxyRtspRtp (保存rtsp代理拉流的rtp流) - 还有 ABLMediaServer.ini 里面的配置参数,如果参数值不填就设置空,不是空格 - mediaServerID = ABLMediaServer_00001 - secret = 035c73f7-bb6b-4889-a715-d9eb2d1925cc - localipAddress = - maxTimeNoOneWatch = 9999999 - recordPath = - picturePath = - maxSameTimeSnap = 16 - snapOutPictureWidth = 0 - snapOutPictureHeight = 0 - snapObjectDestroy = 1 - snapObjectDuration = 120 - captureReplayType = 1 - pictureMaxCount = 30 - pushEnable_mp4 = 0 - fileSecond = 300 - videoFileFormat = 1 - fileKeepMaxTime = 3 - httpDownloadSpeed = 6 - fileRepeat = 0 - H265ConvertH264_enable = 0 - H265DecodeCpuGpuType = 0 - H264DecodeEncode_enable = 0 - filterVideo_enable = 0 - filterVideo_text = ABL水印测试123 - FilterFontSize = 30 - FilterFontColor = red - FilterFontLeft = 5 - FilterFontTop = 5 - FilterFontAlpha = 0.6 - convertOutWidth = 720 - convertOutHeight = 480 - convertMaxObject = 26 - convertOutBitrate = 1024 - hook_enable = 0 - noneReaderDuration = 15 - on_server_started = http://10.0.0.238:4088/index/hook/on_server_started - on_server_keepalive = http://10.0.0.238:4088/index/hook/on_server_keepalive - on_stream_arrive = http://10.0.0.238:4088/index/hook/on_stream_arrive - on_stream_not_arrive = http://10.0.0.238:4088/index/hook/on_stream_not_arrive - on_stream_none_reader = http://10.0.0.238:4088/index/hook/on_stream_none_reader - on_stream_disconnect = http://10.0.0.238:4088/index/hook/on_stream_disconnect - on_stream_not_found = - on_record_mp4 = http://10.0.0.238:4088/index/hook/on_record_mp4 - on_delete_record_mp4 = http://10.0.0.238:4088/index/hook/on_delete_record_mp4 - on_record_progress = http://10.0.0.238:4088/index/hook/on_record_progress - on_record_ts = http://10.0.0.238:4088/index/hook/on_record_ts - httpServerPort = 7088 - rtspPort = 554 - rtmpPort = 1935 - httpMp4Port = 5088 - wsFlvPort = 6088 - httpFlvPort = 8088 - ps_tsRecvPort = 10000 - hls_enable = 0 - hlsPort = 9088 - hlsCutTime = 3 - hlsCutType = 2 - h265CutType = 1 - enable_audio = 1 - G711ConvertAAC = 0 - IOContentNumber = 16 - ThreadCountOfIOContent = 8 - RecvThreadCount = 128 - SendThreadCount = 128 - RecordReplayThread = 32 - GB28181RtpTCPHeadType = 2 - ReConnectingCount = 40320 - MaxDiconnectTimeoutSecond = 36 - ForceSendingIFrame = 1 - value 参数值 详见 ABLMediaServer.ini 的参数值及参数值说明 - - http GET 方式 -   比如: - 打开保存国标PS标志 -    http://44.35.33.239:7088/index/api/setConfigParamValue?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=saveGB28181Rtp&value=1 - 关闭存国标PS标志 -    http://44.35.33.239:7088/index/api/setConfigParamValue?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=saveGB28181Rtp&value=0 - - 打开保存代理拉rtsp流标志 -    http://44.35.33.239:7088/index/api/setConfigParamValue?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=saveProxyRtspRtp&value=1 - 关闭保存代理拉rtsp流标志 -    http://44.35.33.239:7088/index/api/setConfigParamValue?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&key=saveProxyRtspRtp&value=0 - - 24)安全停止服务器 - URL: /index/api/shutdownServer - - 功能: - 安全停止服务器,如果服务器正在录像、抓拍等等操作,需要调用该函数安全停止服务器,这样录制的mp4才能正常播放 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - - http GET 方式 - http://127.0.0.1:7088/index/api/shutdownServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://127.0.0.1:7088/index/api/shutdownServer - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "memo": "ABLMediaServer shutdown Successed !" - } - - 25)重新启动服务器 - URL: /index/api/restartServer - - 功能: - 安全重启服务器,如果服务器正在录像、抓拍等等操作,需要调用该函数安全重启服务器,这样录制的mp4才能正常播放 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - - http GET 方式 - http://127.0.0.1:7088/index/api/restartServer?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://127.0.0.1:7088/index/api/restartServer - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "memo": "ABLMediaServer restartServer Successed ! " - } - - 26)获取当前转码的数量 - URL: /index/api/getTranscodingCount - - 功能: - 获取当前正在转码的数量 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - - http GET 方式 - http://127.0.0.1:7088/index/api/getTranscodingCount?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://127.0.0.1:7088/index/api/getTranscodingCount - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "currentTranscodingCount": 2 - } - - 27)、列举流媒体服务器所有占用端口 - URL: /index/api/listServerPort - - 功能: - 列举流媒体服务器所有占用端口 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - app 应用名 比如 rtp、gb28181、Media 等等 ,自己起的名字 【可选参数】 - stream 媒体流名 比如 Camera_00001、44303403343034243200234 等等 【可选参数】 - - 参数填写样例说明: - 样例1(app、stream 都不填写) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - - 返回所有在线的媒体源 - - 样例2 (只填写 app ) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - app rtp - 返回 app 等于 rtp 的所有媒体源 - - 样例3 (填写 app = rtp , stream = 44303403343034243200234) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - app rtp - stream 44303403343034243200234 - 返回 app 等于 rtp、并且 stream 等于 44303403343034243200234 的所有媒体源 - - 样例4 (填写 stream = 44303403343034243200234) - secret 035c73f7-bb6b-4889-a715-d9eb2d1925cc - stream 44303403343034243200234 - 返回 stream 等于 44303403343034243200234 的所有媒体源 - - http GET 方式 - http://127.0.0.1:7088/index/api/listServerPort?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc - - http POST 方式 - http URL - http://127.0.0.1:7088/index/api/listServerPort - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc"} - - 返回Body: - { - "code": 0, - "memo": "success", - "data": [ - { - "key": 478, - "app": "Media", - "stream": "Camera_00003", - "networkType": 23, - "port": 34988 - }, - { - "key": 477, - "app": "Media", - "stream": "Camera_00002", - "networkType": 23, - "port": 34986 - }, - { - "key": 476, - "app": "Media", - "stream": "Camera_00001", - "networkType": 23, - "port": 34984 - }, - { - "key": 456, - "app": "", - "stream": "", - "networkType": 68, - "port": 10000 - } - ] - } - - 【注释:可以根据 "networkType": 23, 这个字段标识对象的网络类型 ,具体详见网络类型的对照表 】 - - 28)、批量设置服务器的配置参数 - URL: /index/api/setServerConfig - - 功能: - 批量设置服务器的配置参数 - - 参数: 参数说明 参数参考值 - secret 服务器密码 比如 035c73f7-bb6b-4889-a715-d9eb2d1925cc 【必填参数】 - noneReaderDuration 多少秒无人观看通知一次 20 【可选参数】 - on_server_started 服务器启动通知 http://10.0.0.238:4088/index/hook/on_server_started 【可选参数】 - iframeArriveNoticCount i帧达到通知总数 30 【可选参数】 - - http GET 方式 - http://127.0.0.1:7088/index/api/setServerConfig?secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&noneReaderDuration=20&on_server_started=http://10.0.0.238:4088/index/hook/on_server_started&iframeArriveNoticCount=30 - - http POST 方式 - http URL - http://127.0.0.1:7088/index/api/setServerConfig - - http Body 参数 json 格式 - {"secret":"035c73f7-bb6b-4889-a715-d9eb2d1925cc","noneReaderDuration":20,"iframeArriveNoticCount":30,"on_server_started":"http://10.0.0.238:4088/index/hook/on_server_started"} - - 29) 为了方便某些特殊场合,服务器支持udp的10000 端口接入国标PS码流,就是人们常说的单端口模式,url的命名规则为 /rtp/ssrc ,其中ssrc为下级rtp打包 - 的16进制的值转换为大小的字符串,即可sprintf(url,"rtp/%X",ssrc) ,具体接入的url名字可以调用 getMediaList 查询出接入的国标流 。需要注意的是 - 下级 rtp 打包时每路视频的rtp中的ssrc不能相同。 - - - 30) 网络类型的对照表 - 1 媒体输入网络类型对照表 - - 整形值 代表意义 - 21 以rtmp方式推送接入流媒体服务器 - 23 以rtsp方式推送接入流媒体服务器 - 30 服务器以rtsp方式主动拉流接入 - 31 服务器以rtmp方式主动拉流接入 - 32 服务器以flv方式主动拉流接入 - 33 服务器以hls方式主动拉流接入 - 50 代理拉流接入服务器 - 60 服务器以国标28181的UDP方式接入 - 61 服务器以国标28181的TCP方式接入 - - 80 服务器录像文件点播以读取fmp4文件输入 - 81 服务器录像文件点播以读取TS文件输入 - 82 服务器录像文件点播以读取PS文件输入 - 83 服务器录像文件点播以读取FLV文件输入 - - 2 媒体输出网络类型对照表 - 整形值 代表意义 - 22 服务器以rtsp被动方式往外发送码流 ,即常见的vlc点播 - 24 服务器以rtmp被动方式往外发送码流 ,即常见的vlc点播 - 25 服务器以flv被动方式往外发送码流 ,即常见的vlc点播 、浏览器播放 - 26 服务器以hls被动方式往外发送码流 ,即常见的vlc点播 、浏览器播放 - 27 服务器以ws-flv被动方式往外发送码流 ,EasyPlayer.js插件播放、浏览器播放 - 28 服务器以http-mp4被动方式往外发送码流 ,即常见的vlc点播 、浏览器播放 - - 40 服务器以rtsp主动方式往外发送码流 ,即常见的rtsp推流 - 41 服务器以rtmp主动方式往外发送码流 ,即常见的rtmp推流 - 65 服务器以国标GB28181主动UDP方式往外发送码流 ,即常见的国标以UDP方式往上级推流 - 66 服务器以国标GB28181主动TCP方式往外发送码流 ,即常见的国标以TCP方式往上级推流 - \ No newline at end of file diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLRESTfulUtils.java deleted file mode 100755 index 5eca3bf9..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLRESTfulUtils.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.genersoft.iot.vmp.media.abl; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.media.bean.MediaServer; -import okhttp3.*; -import okhttp3.logging.HttpLoggingInterceptor; -import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -@Component -public class ABLRESTfulUtils { - - private final static Logger logger = LoggerFactory.getLogger(ABLRESTfulUtils.class); - - private OkHttpClient client; - - public interface RequestCallback{ - void run(JSONObject response); - } - - private OkHttpClient getClient(){ - return getClient(null); - } - - private OkHttpClient getClient(Integer readTimeOut){ - if (client == null) { - if (readTimeOut == null) { - readTimeOut = 10; - } - OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); - //todo 暂时写死超时时间 均为5s - // 设置连接超时时间 - httpClientBuilder.connectTimeout(8,TimeUnit.SECONDS); - // 设置读取超时时间 - httpClientBuilder.readTimeout(readTimeOut,TimeUnit.SECONDS); - // 设置连接池 - httpClientBuilder.connectionPool(new ConnectionPool(16, 5, TimeUnit.MINUTES)); - if (logger.isDebugEnabled()) { - HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> { - logger.debug("http请求参数:" + message); - }); - logging.setLevel(HttpLoggingInterceptor.Level.BASIC); - // OkHttp進行添加攔截器loggingInterceptor - httpClientBuilder.addInterceptor(logging); - } - client = httpClientBuilder.build(); - } - return client; - - } - - public JSONObject sendPost(MediaServer mediaServerItem, String api, Map param, RequestCallback callback) { - return sendPost(mediaServerItem, api, param, callback, null); - } - - - public JSONObject sendPost(MediaServer mediaServerItem, String api, Map param, RequestCallback callback, Integer readTimeOut) { - OkHttpClient client = getClient(readTimeOut); - - if (mediaServerItem == null) { - return null; - } - String url = String.format("http://%s:%s/index/api/%s", mediaServerItem.getIp(), mediaServerItem.getHttpPort(), api); - JSONObject responseJSON = new JSONObject(); - //-2自定义流媒体 调用错误码 - responseJSON.put("code",-2); - responseJSON.put("msg","流媒体调用失败"); - - FormBody.Builder builder = new FormBody.Builder(); - builder.add("secret",mediaServerItem.getSecret()); - if (param != null && param.keySet().size() > 0) { - for (String key : param.keySet()){ - if (param.get(key) != null) { - builder.add(key, param.get(key).toString()); - } - } - } - - FormBody body = builder.build(); - - Request request = new Request.Builder() - .post(body) - .url(url) - .build(); - if (callback == null) { - try { - Response response = client.newCall(request).execute(); - - if (response.isSuccessful()) { - ResponseBody responseBody = response.body(); - if (responseBody != null) { - String responseStr = responseBody.string(); - responseJSON = JSON.parseObject(responseStr); - } - }else { - System.out.println( 2222); - System.out.println( response.code()); - response.close(); - Objects.requireNonNull(response.body()).close(); - } - }catch (IOException e) { - logger.error(String.format("[ %s ]请求失败: %s", url, e.getMessage())); - - if(e instanceof SocketTimeoutException){ - //读取超时超时异常 - logger.error(String.format("读取ABL数据超时失败: %s, %s", url, e.getMessage())); - } - if(e instanceof ConnectException){ - //判断连接异常,我这里是报Failed to connect to 10.7.5.144 - logger.error(String.format("连接ABL连接失败: %s, %s", url, e.getMessage())); - } - - }catch (Exception e){ - logger.error(String.format("访问ABL失败: %s, %s", url, e.getMessage())); - } - }else { - client.newCall(request).enqueue(new Callback(){ - - @Override - public void onResponse(@NotNull Call call, @NotNull Response response){ - if (response.isSuccessful()) { - try { - String responseStr = Objects.requireNonNull(response.body()).string(); - callback.run(JSON.parseObject(responseStr)); - } catch (IOException e) { - logger.error(String.format("[ %s ]请求失败: %s", url, e.getMessage())); - } - - }else { - response.close(); - Objects.requireNonNull(response.body()).close(); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - logger.error(String.format("连接ABL失败: %s, %s", call.request().toString(), e.getMessage())); - - if(e instanceof SocketTimeoutException){ - //读取超时超时异常 - logger.error(String.format("读取ABL数据失败: %s, %s", call.request().toString(), e.getMessage())); - } - if(e instanceof ConnectException){ - //判断连接异常,我这里是报Failed to connect to 10.7.5.144 - logger.error(String.format("连接ABL失败: %s, %s", call.request().toString(), e.getMessage())); - } - } - }); - } - - - - return responseJSON; - } - - public JSONObject sendGet(MediaServer mediaServerItem, String api, Map param) { - OkHttpClient client = getClient(); - - if (mediaServerItem == null) { - return null; - } - JSONObject responseJSON = null; - StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append(String.format("http://%s:%s/index/api/%s", mediaServerItem.getIp(), mediaServerItem.getHttpPort(), api)); - if (param != null && !param.keySet().isEmpty()) { - stringBuffer.append("?secret=").append(mediaServerItem.getSecret()).append("&"); - int index = 1; - for (String key : param.keySet()){ - if (param.get(key) != null) { - stringBuffer.append(key + "=" + param.get(key)); - if (index < param.size()) { - stringBuffer.append("&"); - } - } - index++; - } - } - String url = stringBuffer.toString(); - logger.info("[访问ABL]: {}", url); - Request request = new Request.Builder() - .get() - .url(url) - .build(); - try { - Response response = client.newCall(request).execute(); - if (response.isSuccessful()) { - ResponseBody responseBody = response.body(); - if (responseBody != null) { - String responseStr = responseBody.string(); - responseJSON = JSON.parseObject(responseStr); - } - }else { - response.close(); - Objects.requireNonNull(response.body()).close(); - } - } catch (ConnectException e) { - logger.error(String.format("连接ABL失败: %s, %s", e.getCause().getMessage(), e.getMessage())); - logger.info("请检查media配置并确认ABL已启动..."); - }catch (IOException e) { - logger.error(String.format("[ %s ]请求失败: %s", url, e.getMessage())); - } - - - - return responseJSON; - } - - public void sendGetForImg(MediaServer mediaServerItem, String api, Map params, String targetPath, String fileName) { - String url = String.format("http://%s:%s/index/api/%s", mediaServerItem.getIp(), mediaServerItem.getHttpPort(), api); - HttpUrl parseUrl = HttpUrl.parse(url); - if (parseUrl == null) { - return; - } - HttpUrl.Builder httpBuilder = parseUrl.newBuilder(); - - httpBuilder.addQueryParameter("secret", mediaServerItem.getSecret()); - if (params != null) { - for (Map.Entry param : params.entrySet()) { - httpBuilder.addQueryParameter(param.getKey(), param.getValue().toString()); - } - } - - Request request = new Request.Builder() - .url(httpBuilder.build()) - .build(); - logger.info(request.toString()); - try { - OkHttpClient client = getClient(); - Response response = client.newCall(request).execute(); - if (response.isSuccessful()) { - if (targetPath != null) { - File snapFolder = new File(targetPath); - if (!snapFolder.exists()) { - if (!snapFolder.mkdirs()) { - logger.warn("{}路径创建失败", snapFolder.getAbsolutePath()); - } - - } - File snapFile = new File(targetPath + File.separator + fileName); - FileOutputStream outStream = new FileOutputStream(snapFile); - - outStream.write(Objects.requireNonNull(response.body()).bytes()); - outStream.flush(); - outStream.close(); - } else { - logger.error(String.format("[ %s ]请求失败: %s %s", url, response.code(), response.message())); - } - } else { - logger.error(String.format("[ %s ]请求失败: %s %s", url, response.code(), response.message())); - } - Objects.requireNonNull(response.body()).close(); - } catch (ConnectException e) { - logger.error(String.format("连接ABL失败: %s, %s", e.getCause().getMessage(), e.getMessage())); - logger.info("请检查media配置并确认ABL已启动..."); - } catch (IOException e) { - logger.error(String.format("[ %s ]请求失败: %s", url, e.getMessage())); - } - } - - - public Integer openRtpServer(MediaServer mediaServer, String app, String stream, int payload, Integer port, Integer tcpMode, Integer disableAudio) { - Map param = new HashMap<>(); - param.put("vhost", "_defaultVhost_"); - param.put("app", app); - param.put("stream_id", stream); - param.put("payload", payload); - if (port != null) { - param.put("port", port); - } - if (tcpMode != null) { - param.put("enable_tcp", tcpMode); - } - if (disableAudio != null) { - param.put("disableAudio", disableAudio); - } - - JSONObject jsonObject = sendPost(mediaServer, "openRtpServer", param, null); - if (jsonObject.getInteger("code") == 0) { - return jsonObject.getInteger("port"); - }else { - return 0; - } - } - - public JSONObject closeStreams(MediaServer mediaServerItem, String app, String stream) { - Map param = new HashMap<>(); - param.put("vhost", "__defaultVhost__"); - param.put("app", app); - param.put("stream", stream); - param.put("force", 1); - return sendPost(mediaServerItem, "close_streams",param, null); - } - - public JSONObject getServerConfig(MediaServer mediaServerItem){ - return sendPost(mediaServerItem, "getServerConfig",null, null); - } - - public JSONObject setConfigParamValue(MediaServer mediaServerItem, String key, Object value){ - Map param = new HashMap<>(); - param.put("key", key); - param.put("value", value); - return sendGet(mediaServerItem,"setConfigParamValue", param); - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblServerConfig.java deleted file mode 100644 index dc0edecd..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblServerConfig.java +++ /dev/null @@ -1,812 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean; - -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -public class AblServerConfig { - - @ConfigKeyId("secret") - private String secret; - - @ConfigKeyId("ServerIP") - private String serverIp; - - @ConfigKeyId("mediaServerID") - private String mediaServerId; - - @ConfigKeyId("hook_enable") - private Integer hookEnable; - - @ConfigKeyId("enable_audio") - private Integer enableAudio; - - @ConfigKeyId("httpServerPort") - private Integer httpServerPort; - - @ConfigKeyId("rtspPort") - private Integer rtspPort; - - @ConfigKeyId("rtmpPort") - private Integer rtmpPort; - - @ConfigKeyId("httpFlvPort") - private Integer httpFlvPort; - - @ConfigKeyId("hls_enable") - private Integer hlsEnable; - - @ConfigKeyId("hlsPort") - private Integer hlsPort; - - @ConfigKeyId("wsPort") - private Integer wsPort; - - @ConfigKeyId("mp4Port") - private Integer mp4Port; - - @ConfigKeyId("ps_tsRecvPort") - private Integer psTsRecvPort; - - @ConfigKeyId("hlsCutType") - private Integer hlsCutType; - - @ConfigKeyId("h265CutType") - private Integer h265CutType; - - @ConfigKeyId("RecvThreadCount") - private Integer RecvThreadCount; - - @ConfigKeyId("SendThreadCount") - private Integer SendThreadCount; - - @ConfigKeyId("GB28181RtpTCPHeadType") - private Integer GB28181RtpTCPHeadType; - - @ConfigKeyId("ReConnectingCount") - private Integer ReConnectingCount; - - @ConfigKeyId("maxTimeNoOneWatch") - private Integer maxTimeNoOneWatch; - - @ConfigKeyId("pushEnable_mp4") - private Integer pushEnableMp4; - - @ConfigKeyId("fileSecond") - private Integer fileSecond; - - @ConfigKeyId("fileKeepMaxTime") - private Integer fileKeepMaxTime; - - @ConfigKeyId("httpDownloadSpeed") - private Integer httpDownloadSpeed; - - @ConfigKeyId("RecordReplayThread") - private Integer RecordReplayThread; - - @ConfigKeyId("convertMaxObject") - private Integer convertMaxObject; - - @ConfigKeyId("version") - private String version; - - @ConfigKeyId("recordPath") - private String recordPath; - - @ConfigKeyId("picturePath") - private String picturePath; - - @ConfigKeyId("noneReaderDuration") - private Integer noneReaderDuration; - - @ConfigKeyId("on_server_started") - private String onServerStarted; - - @ConfigKeyId("on_server_keepalive") - private String onServerKeepalive; - - @ConfigKeyId("on_play") - private String onPlay; - - @ConfigKeyId("on_publish") - private String onPublish; - - @ConfigKeyId("on_stream_arrive") - private String onStreamArrive; - - @ConfigKeyId("on_stream_not_arrive") - private String onStreamNotArrive; - - @ConfigKeyId("on_stream_none_reader") - private String onStreamNoneReader; - - @ConfigKeyId("on_stream_disconnect") - private String onStreamDisconnect; - - @ConfigKeyId("on_stream_not_found") - private String onStreamNotFound; - - @ConfigKeyId("on_record_mp4") - private String onRecordMp4; - - @ConfigKeyId("on_delete_record_mp4") - private String onDeleteRecordMp4; - - @ConfigKeyId("on_record_progress") - private String onRecordProgress; - - @ConfigKeyId("on_record_ts") - private String onRecordTs; - - @ConfigKeyId("enable_GetFileDuration") - private Integer enableGetFileDuration; - - @ConfigKeyId("keepaliveDuration") - private Integer keepaliveDuration; - - @ConfigKeyId("captureReplayType") - private Integer captureReplayType; - - @ConfigKeyId("pictureMaxCount") - private Integer pictureMaxCount; - - @ConfigKeyId("videoFileFormat") - private Integer videoFileFormat; - - @ConfigKeyId("MaxDiconnectTimeoutSecond") - private Integer maxDiconnectTimeoutSecond; - - @ConfigKeyId("G711ConvertAAC") - private Integer g711ConvertAAC; - - @ConfigKeyId("filterVideo_enable") - private Integer filterVideoEnable; - - @ConfigKeyId("filterVideo_text") - private String filterVideoText; - - @ConfigKeyId("FilterFontSize") - private Integer filterFontSize; - - @ConfigKeyId("FilterFontColor") - private String filterFontColor; - - @ConfigKeyId("FilterFontLeft") - private Integer filterFontLeft; - - @ConfigKeyId("FilterFontTop") - private Integer filterFontTop; - - @ConfigKeyId("FilterFontAlpha") - private Double filterFontAlpha; - - @ConfigKeyId("convertOutWidth") - private Integer convertOutWidth; - - @ConfigKeyId("convertOutHeight") - private Integer convertOutHeight; - - @ConfigKeyId("convertOutBitrate") - private Integer convertOutBitrate; - - @ConfigKeyId("flvPlayAddMute") - private Integer flvPlayAddMute; - - @ConfigKeyId("gb28181LibraryUse") - private Integer gb28181LibraryUse; - - @ConfigKeyId("rtc.listening-ip") - private String rtcListeningIp; - - @ConfigKeyId("rtc.listening-port") - private Integer rtcListeningIpPort; - - @ConfigKeyId("rtc.external-ip") - private String rtcExternalIp; - - @ConfigKeyId("rtc.realm") - private String rtcRealm; - - @ConfigKeyId("rtc.user") - private String rtcUser; - - @ConfigKeyId("rtc.min-port") - private Integer rtcMinPort; - - @ConfigKeyId("rtc.max-port") - private Integer rtcMaxPort; - - public static AblServerConfig getInstance(JSONArray jsonArray) { - if (jsonArray == null || jsonArray.isEmpty()) { - return null; - } - AblServerConfig ablServerConfig = new AblServerConfig(); - Field[] fields = AblServerConfig.class.getDeclaredFields(); - Map fieldMap = new HashMap<>(); - for (Field field : fields) { - if (field.isAnnotationPresent(ConfigKeyId.class)) { - ConfigKeyId configKeyId = field.getAnnotation(ConfigKeyId.class); - fieldMap.put(configKeyId.value(), field); - } - } - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - if (jsonObject == null) { - continue; - } - for (String key : fieldMap.keySet()) { - if (jsonObject.containsKey(key)) { - Field field = fieldMap.get(key); - field.setAccessible(true); - try { - field.set(ablServerConfig, jsonObject.getObject(key, fieldMap.get(key).getType())); - } catch (IllegalAccessException e) {} - } - } - } - return ablServerConfig; - } - - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public String getServerIp() { - return serverIp; - } - - public void setServerIp(String serverIp) { - this.serverIp = serverIp; - } - - public String getMediaServerId() { - return mediaServerId; - } - - public void setMediaServerId(String mediaServerId) { - this.mediaServerId = mediaServerId; - } - - public Integer getHookEnable() { - return hookEnable; - } - - public void setHookEnable(Integer hookEnable) { - this.hookEnable = hookEnable; - } - - public Integer getEnableAudio() { - return enableAudio; - } - - public void setEnableAudio(Integer enableAudio) { - this.enableAudio = enableAudio; - } - - public Integer getHttpServerPort() { - return httpServerPort; - } - - public void setHttpServerPort(Integer httpServerPort) { - this.httpServerPort = httpServerPort; - } - - public Integer getRtspPort() { - return rtspPort; - } - - public void setRtspPort(Integer rtspPort) { - this.rtspPort = rtspPort; - } - - public Integer getRtmpPort() { - return rtmpPort; - } - - public void setRtmpPort(Integer rtmpPort) { - this.rtmpPort = rtmpPort; - } - - public Integer getHttpFlvPort() { - return httpFlvPort; - } - - public void setHttpFlvPort(Integer httpFlvPort) { - this.httpFlvPort = httpFlvPort; - } - - public Integer getHlsEnable() { - return hlsEnable; - } - - public void setHlsEnable(Integer hlsEnable) { - this.hlsEnable = hlsEnable; - } - - public Integer getHlsPort() { - return hlsPort; - } - - public void setHlsPort(Integer hlsPort) { - this.hlsPort = hlsPort; - } - - public Integer getWsPort() { - return wsPort; - } - - public void setWsPort(Integer wsPort) { - this.wsPort = wsPort; - } - - public Integer getMp4Port() { - return mp4Port; - } - - public void setMp4Port(Integer mp4Port) { - this.mp4Port = mp4Port; - } - - public Integer getPsTsRecvPort() { - return psTsRecvPort; - } - - public void setPsTsRecvPort(Integer psTsRecvPort) { - this.psTsRecvPort = psTsRecvPort; - } - - public Integer getHlsCutType() { - return hlsCutType; - } - - public void setHlsCutType(Integer hlsCutType) { - this.hlsCutType = hlsCutType; - } - - public Integer getH265CutType() { - return h265CutType; - } - - public void setH265CutType(Integer h265CutType) { - this.h265CutType = h265CutType; - } - - public Integer getRecvThreadCount() { - return RecvThreadCount; - } - - public void setRecvThreadCount(Integer recvThreadCount) { - RecvThreadCount = recvThreadCount; - } - - public Integer getSendThreadCount() { - return SendThreadCount; - } - - public void setSendThreadCount(Integer sendThreadCount) { - SendThreadCount = sendThreadCount; - } - - public Integer getGB28181RtpTCPHeadType() { - return GB28181RtpTCPHeadType; - } - - public void setGB28181RtpTCPHeadType(Integer GB28181RtpTCPHeadType) { - this.GB28181RtpTCPHeadType = GB28181RtpTCPHeadType; - } - - public Integer getReConnectingCount() { - return ReConnectingCount; - } - - public void setReConnectingCount(Integer reConnectingCount) { - ReConnectingCount = reConnectingCount; - } - - public Integer getMaxTimeNoOneWatch() { - return maxTimeNoOneWatch; - } - - public void setMaxTimeNoOneWatch(Integer maxTimeNoOneWatch) { - this.maxTimeNoOneWatch = maxTimeNoOneWatch; - } - - public Integer getPushEnableMp4() { - return pushEnableMp4; - } - - public void setPushEnableMp4(Integer pushEnableMp4) { - this.pushEnableMp4 = pushEnableMp4; - } - - public Integer getFileSecond() { - return fileSecond; - } - - public void setFileSecond(Integer fileSecond) { - this.fileSecond = fileSecond; - } - - public Integer getFileKeepMaxTime() { - return fileKeepMaxTime; - } - - public void setFileKeepMaxTime(Integer fileKeepMaxTime) { - this.fileKeepMaxTime = fileKeepMaxTime; - } - - public Integer getHttpDownloadSpeed() { - return httpDownloadSpeed; - } - - public void setHttpDownloadSpeed(Integer httpDownloadSpeed) { - this.httpDownloadSpeed = httpDownloadSpeed; - } - - public Integer getRecordReplayThread() { - return RecordReplayThread; - } - - public void setRecordReplayThread(Integer recordReplayThread) { - RecordReplayThread = recordReplayThread; - } - - public Integer getConvertMaxObject() { - return convertMaxObject; - } - - public void setConvertMaxObject(Integer convertMaxObject) { - this.convertMaxObject = convertMaxObject; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getRecordPath() { - return recordPath; - } - - public void setRecordPath(String recordPath) { - this.recordPath = recordPath; - } - - public String getPicturePath() { - return picturePath; - } - - public void setPicturePath(String picturePath) { - this.picturePath = picturePath; - } - - public Integer getNoneReaderDuration() { - return noneReaderDuration; - } - - public void setNoneReaderDuration(Integer noneReaderDuration) { - this.noneReaderDuration = noneReaderDuration; - } - - public String getOnServerStarted() { - return onServerStarted; - } - - public void setOnServerStarted(String onServerStarted) { - this.onServerStarted = onServerStarted; - } - - public String getOnServerKeepalive() { - return onServerKeepalive; - } - - public void setOnServerKeepalive(String onServerKeepalive) { - this.onServerKeepalive = onServerKeepalive; - } - - public String getOnPlay() { - return onPlay; - } - - public void setOnPlay(String onPlay) { - this.onPlay = onPlay; - } - - public String getOnPublish() { - return onPublish; - } - - public void setOnPublish(String onPublish) { - this.onPublish = onPublish; - } - - public String getOnStreamArrive() { - return onStreamArrive; - } - - public void setOnStreamArrive(String onStreamArrive) { - this.onStreamArrive = onStreamArrive; - } - - public String getOnStreamNotArrive() { - return onStreamNotArrive; - } - - public void setOnStreamNotArrive(String onStreamNotArrive) { - this.onStreamNotArrive = onStreamNotArrive; - } - - public String getOnStreamNoneReader() { - return onStreamNoneReader; - } - - public void setOnStreamNoneReader(String onStreamNoneReader) { - this.onStreamNoneReader = onStreamNoneReader; - } - - public String getOnStreamDisconnect() { - return onStreamDisconnect; - } - - public void setOnStreamDisconnect(String onStreamDisconnect) { - this.onStreamDisconnect = onStreamDisconnect; - } - - public String getOnDeleteRecordMp4() { - return onDeleteRecordMp4; - } - - public void setOnDeleteRecordMp4(String onDeleteRecordMp4) { - this.onDeleteRecordMp4 = onDeleteRecordMp4; - } - - public String getOnRecordProgress() { - return onRecordProgress; - } - - public void setOnRecordProgress(String onRecordProgress) { - this.onRecordProgress = onRecordProgress; - } - - public String getOnRecordTs() { - return onRecordTs; - } - - public void setOnRecordTs(String onRecordTs) { - this.onRecordTs = onRecordTs; - } - - public Integer getEnableGetFileDuration() { - return enableGetFileDuration; - } - - public void setEnableGetFileDuration(Integer enableGetFileDuration) { - this.enableGetFileDuration = enableGetFileDuration; - } - - public Integer getKeepaliveDuration() { - return keepaliveDuration; - } - - public void setKeepaliveDuration(Integer keepaliveDuration) { - this.keepaliveDuration = keepaliveDuration; - } - - public Integer getCaptureReplayType() { - return captureReplayType; - } - - public void setCaptureReplayType(Integer captureReplayType) { - this.captureReplayType = captureReplayType; - } - - public Integer getVideoFileFormat() { - return videoFileFormat; - } - - public void setVideoFileFormat(Integer videoFileFormat) { - this.videoFileFormat = videoFileFormat; - } - - public Integer getMaxDiconnectTimeoutSecond() { - return maxDiconnectTimeoutSecond; - } - - public void setMaxDiconnectTimeoutSecond(Integer maxDiconnectTimeoutSecond) { - this.maxDiconnectTimeoutSecond = maxDiconnectTimeoutSecond; - } - - public Integer getG711ConvertAAC() { - return g711ConvertAAC; - } - - public void setG711ConvertAAC(Integer g711ConvertAAC) { - this.g711ConvertAAC = g711ConvertAAC; - } - - public Integer getFilterVideoEnable() { - return filterVideoEnable; - } - - public void setFilterVideoEnable(Integer filterVideoEnable) { - this.filterVideoEnable = filterVideoEnable; - } - - public String getFilterVideoText() { - return filterVideoText; - } - - public void setFilterVideoText(String filterVideoText) { - this.filterVideoText = filterVideoText; - } - - public Integer getFilterFontSize() { - return filterFontSize; - } - - public void setFilterFontSize(Integer filterFontSize) { - this.filterFontSize = filterFontSize; - } - - public String getFilterFontColor() { - return filterFontColor; - } - - public void setFilterFontColor(String filterFontColor) { - this.filterFontColor = filterFontColor; - } - - public Integer getFilterFontLeft() { - return filterFontLeft; - } - - public void setFilterFontLeft(Integer filterFontLeft) { - this.filterFontLeft = filterFontLeft; - } - - public Integer getFilterFontTop() { - return filterFontTop; - } - - public void setFilterFontTop(Integer filterFontTop) { - this.filterFontTop = filterFontTop; - } - - public Double getFilterFontAlpha() { - return filterFontAlpha; - } - - public void setFilterFontAlpha(Double filterFontAlpha) { - this.filterFontAlpha = filterFontAlpha; - } - - public Integer getConvertOutWidth() { - return convertOutWidth; - } - - public void setConvertOutWidth(Integer convertOutWidth) { - this.convertOutWidth = convertOutWidth; - } - - public Integer getConvertOutHeight() { - return convertOutHeight; - } - - public void setConvertOutHeight(Integer convertOutHeight) { - this.convertOutHeight = convertOutHeight; - } - - public Integer getConvertOutBitrate() { - return convertOutBitrate; - } - - public void setConvertOutBitrate(Integer convertOutBitrate) { - this.convertOutBitrate = convertOutBitrate; - } - - public Integer getFlvPlayAddMute() { - return flvPlayAddMute; - } - - public void setFlvPlayAddMute(Integer flvPlayAddMute) { - this.flvPlayAddMute = flvPlayAddMute; - } - - public Integer getGb28181LibraryUse() { - return gb28181LibraryUse; - } - - public void setGb28181LibraryUse(Integer gb28181LibraryUse) { - this.gb28181LibraryUse = gb28181LibraryUse; - } - - public String getRtcListeningIp() { - return rtcListeningIp; - } - - public void setRtcListeningIp(String rtcListeningIp) { - this.rtcListeningIp = rtcListeningIp; - } - - public Integer getRtcListeningIpPort() { - return rtcListeningIpPort; - } - - public void setRtcListeningIpPort(Integer rtcListeningIpPort) { - this.rtcListeningIpPort = rtcListeningIpPort; - } - - public String getRtcExternalIp() { - return rtcExternalIp; - } - - public void setRtcExternalIp(String rtcExternalIp) { - this.rtcExternalIp = rtcExternalIp; - } - - public String getRtcRealm() { - return rtcRealm; - } - - public void setRtcRealm(String rtcRealm) { - this.rtcRealm = rtcRealm; - } - - public String getRtcUser() { - return rtcUser; - } - - public void setRtcUser(String rtcUser) { - this.rtcUser = rtcUser; - } - - public Integer getRtcMinPort() { - return rtcMinPort; - } - - public void setRtcMinPort(Integer rtcMinPort) { - this.rtcMinPort = rtcMinPort; - } - - public Integer getRtcMaxPort() { - return rtcMaxPort; - } - - public void setRtcMaxPort(Integer rtcMaxPort) { - this.rtcMaxPort = rtcMaxPort; - } - - public String getOnRecordMp4() { - return onRecordMp4; - } - - public void setOnRecordMp4(String onRecordMp4) { - this.onRecordMp4 = onRecordMp4; - } - - public Integer getPictureMaxCount() { - return pictureMaxCount; - } - - public void setPictureMaxCount(Integer pictureMaxCount) { - this.pictureMaxCount = pictureMaxCount; - } - - public String getOnStreamNotFound() { - return onStreamNotFound; - } - - public void setOnStreamNotFound(String onStreamNotFound) { - this.onStreamNotFound = onStreamNotFound; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblUrls.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblUrls.java deleted file mode 100644 index 42e05a04..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/AblUrls.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean; - -public class AblUrls { - private String rtsp; - private String rtmp; - private String httpFlv; - private String wsFlv; - private String httpMp4; - private String httpHls; - - public String getRtsp() { - return rtsp; - } - - public void setRtsp(String rtsp) { - this.rtsp = rtsp; - } - - public String getRtmp() { - return rtmp; - } - - public void setRtmp(String rtmp) { - this.rtmp = rtmp; - } - - public String getHttpFlv() { - return httpFlv; - } - - public void setHttpFlv(String httpFlv) { - this.httpFlv = httpFlv; - } - - public String getWsFlv() { - return wsFlv; - } - - public void setWsFlv(String wsFlv) { - this.wsFlv = wsFlv; - } - - public String getHttpMp4() { - return httpMp4; - } - - public void setHttpMp4(String httpMp4) { - this.httpMp4 = httpMp4; - } - - public String getHttpHls() { - return httpHls; - } - - public void setHttpHls(String httpHls) { - this.httpHls = httpHls; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/ConfigKeyId.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/ConfigKeyId.java deleted file mode 100644 index 244bb949..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/ConfigKeyId.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean; - -import java.lang.annotation.*; - -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface ConfigKeyId { - String value(); -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/ABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/ABLHookParam.java deleted file mode 100644 index 796935ea..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/ABLHookParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class ABLHookParam { - private String mediaServerId; - - /** - * 应用名 - */ - private String app; - - /** - * 流id - */ - private String stream; - - /** - * 媒体流来源编号,可以根据这个key进行关闭流媒体 可以调用delMediaStream或close_streams 函数进行关闭 - */ - private String key; - - /** - * 媒体流来源网络编号,可参考附表 - */ - private Integer networkType; - - public String getMediaServerId() { - return mediaServerId; - } - - public void setMediaServerId(String mediaServerId) { - this.mediaServerId = mediaServerId; - } - - public String getApp() { - return app; - } - - public void setApp(String app) { - this.app = app; - } - - public String getStream() { - return stream; - } - - public void setStream(String stream) { - this.stream = stream; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public Integer getNetworkType() { - return networkType; - } - - public void setNetworkType(Integer networkType) { - this.networkType = networkType; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPlayABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPlayABLHookParam.java deleted file mode 100644 index af18210e..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPlayABLHookParam.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnPlayABLHookParam extends ABLHookParam{ - private String ip; - private Integer port; - private String params; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPublishABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPublishABLHookParam.java deleted file mode 100644 index 11da2740..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnPublishABLHookParam.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnPublishABLHookParam extends ABLHookParam{ - private String ip; - private Integer port; - private String params; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public Integer getPort() { - return port; - } - - public void setPort(Integer port) { - this.port = port; - } - - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordMp4ABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordMp4ABLHookParam.java deleted file mode 100644 index 0fb819fa..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordMp4ABLHookParam.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnRecordMp4ABLHookParam extends ABLHookParam{ - private String fileName; - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordProgressABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordProgressABLHookParam.java deleted file mode 100644 index 8f70781b..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnRecordProgressABLHookParam.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnRecordProgressABLHookParam extends OnRecordMp4ABLHookParam{ - private Integer currentFileDuration; - private Integer TotalVideoDuration; - - public Integer getCurrentFileDuration() { - return currentFileDuration; - } - - public void setCurrentFileDuration(Integer currentFileDuration) { - this.currentFileDuration = currentFileDuration; - } - - public Integer getTotalVideoDuration() { - return TotalVideoDuration; - } - - public void setTotalVideoDuration(Integer totalVideoDuration) { - TotalVideoDuration = totalVideoDuration; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerKeepaliveABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerKeepaliveABLHookParam.java deleted file mode 100644 index ea1ac970..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerKeepaliveABLHookParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnServerKeepaliveABLHookParam { - private String localipAddress; - private String mediaServerId; - private String datetime; - - - public String getLocalipAddress() { - return localipAddress; - } - - public void setLocalipAddress(String localipAddress) { - this.localipAddress = localipAddress; - } - - public String getMediaServerId() { - return mediaServerId; - } - - public void setMediaServerId(String mediaServerId) { - this.mediaServerId = mediaServerId; - } - - public String getDatetime() { - return datetime; - } - - public void setDatetime(String datetime) { - this.datetime = datetime; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerStaredABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerStaredABLHookParam.java deleted file mode 100644 index a9ec44c0..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnServerStaredABLHookParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -public class OnServerStaredABLHookParam { - private String localipAddress; - private String mediaServerId; - private String datetime; - - - public String getLocalipAddress() { - return localipAddress; - } - - public void setLocalipAddress(String localipAddress) { - this.localipAddress = localipAddress; - } - - public String getMediaServerId() { - return mediaServerId; - } - - public void setMediaServerId(String mediaServerId) { - this.mediaServerId = mediaServerId; - } - - public String getDatetime() { - return datetime; - } - - public void setDatetime(String datetime) { - this.datetime = datetime; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnStreamArriveABLHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnStreamArriveABLHookParam.java deleted file mode 100644 index efe9b126..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/bean/hook/OnStreamArriveABLHookParam.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.bean.hook; - -import com.genersoft.iot.vmp.media.abl.bean.AblUrls; - -/** - * 流到来的事件 - */ -public class OnStreamArriveABLHookParam extends ABLHookParam{ - - - - /** - * 推流鉴权Id - */ - private String callId; - - /** - * 状态 - */ - private Boolean status; - - - /** - * - */ - private Boolean enableHls; - - - /** - * - */ - private Boolean transcodingStatus; - - - /** - * - */ - private String sourceURL; - - - /** - * - */ - private Integer readerCount; - - - /** - * - */ - private Integer noneReaderDuration; - - - /** - * - */ - private String videoCodec; - - - /** - * - */ - private Integer videoFrameSpeed; - - - /** - * - */ - private Integer width; - - - /** - * - */ - private Integer height; - - - /** - * - */ - private Integer videoBitrate; - - - /** - * - */ - private String audioCodec; - - - /** - * - */ - private Integer audioChannels; - - - /** - * - */ - private Integer audioSampleRate; - - - /** - * - */ - private Integer audioBitrate; - - - private AblUrls url; - - - public String getCallId() { - return callId; - } - - public void setCallId(String callId) { - this.callId = callId; - } - - public Boolean getStatus() { - return status; - } - - public void setStatus(Boolean status) { - this.status = status; - } - - public Boolean getEnableHls() { - return enableHls; - } - - public void setEnableHls(Boolean enableHls) { - this.enableHls = enableHls; - } - - public Boolean getTranscodingStatus() { - return transcodingStatus; - } - - public void setTranscodingStatus(Boolean transcodingStatus) { - this.transcodingStatus = transcodingStatus; - } - - public String getSourceURL() { - return sourceURL; - } - - public void setSourceURL(String sourceURL) { - this.sourceURL = sourceURL; - } - - public Integer getReaderCount() { - return readerCount; - } - - public void setReaderCount(Integer readerCount) { - this.readerCount = readerCount; - } - - public Integer getNoneReaderDuration() { - return noneReaderDuration; - } - - public void setNoneReaderDuration(Integer noneReaderDuration) { - this.noneReaderDuration = noneReaderDuration; - } - - public String getVideoCodec() { - return videoCodec; - } - - public void setVideoCodec(String videoCodec) { - this.videoCodec = videoCodec; - } - - public Integer getVideoFrameSpeed() { - return videoFrameSpeed; - } - - public void setVideoFrameSpeed(Integer videoFrameSpeed) { - this.videoFrameSpeed = videoFrameSpeed; - } - - public Integer getWidth() { - return width; - } - - public void setWidth(Integer width) { - this.width = width; - } - - public Integer getHeight() { - return height; - } - - public void setHeight(Integer height) { - this.height = height; - } - - public Integer getVideoBitrate() { - return videoBitrate; - } - - public void setVideoBitrate(Integer videoBitrate) { - this.videoBitrate = videoBitrate; - } - - public String getAudioCodec() { - return audioCodec; - } - - public void setAudioCodec(String audioCodec) { - this.audioCodec = audioCodec; - } - - public Integer getAudioChannels() { - return audioChannels; - } - - public void setAudioChannels(Integer audioChannels) { - this.audioChannels = audioChannels; - } - - public Integer getAudioSampleRate() { - return audioSampleRate; - } - - public void setAudioSampleRate(Integer audioSampleRate) { - this.audioSampleRate = audioSampleRate; - } - - public Integer getAudioBitrate() { - return audioBitrate; - } - - public void setAudioBitrate(Integer audioBitrate) { - this.audioBitrate = audioBitrate; - } - - public AblUrls getUrl() { - return url; - } - - public void setUrl(AblUrls url) { - this.url = url; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerKeepaliveEvent.java b/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerKeepaliveEvent.java deleted file mode 100644 index 74465e4c..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerKeepaliveEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.event; - -import com.genersoft.iot.vmp.media.bean.MediaServer; -import org.springframework.context.ApplicationEvent; - -/** - * zlm 心跳事件 - */ -public class HookAblServerKeepaliveEvent extends ApplicationEvent { - - public HookAblServerKeepaliveEvent(Object source) { - super(source); - } - - private MediaServer mediaServerItem; - - public MediaServer getMediaServerItem() { - return mediaServerItem; - } - - public void setMediaServerItem(MediaServer mediaServerItem) { - this.mediaServerItem = mediaServerItem; - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerStartEvent.java b/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerStartEvent.java deleted file mode 100644 index 12bdac06..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/abl/event/HookAblServerStartEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.genersoft.iot.vmp.media.abl.event; - -import com.genersoft.iot.vmp.media.bean.MediaServer; -import org.springframework.context.ApplicationEvent; - -/** - * zlm server_start事件 - */ -public class HookAblServerStartEvent extends ApplicationEvent { - - public HookAblServerStartEvent(Object source) { - super(source); - } - - private MediaServer mediaServerItem; - - public MediaServer getMediaServerItem() { - return mediaServerItem; - } - - public void setMediaServerItem(MediaServer mediaServerItem) { - this.mediaServerItem = mediaServerItem; - } -}