| | |
| | | return sendPost("getRtpInfo",param, null); |
| | | } |
| | | |
| | | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){ |
| | | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms, |
| | | boolean enable_hls, boolean enable_mp4, String ffmpeg_cmd_key){ |
| | | logger.info(src_url); |
| | | logger.info(dst_url); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("src_url", src_url); |
| | | param.put("dst_url", dst_url); |
| | | param.put("timeout_ms", timeout_ms); |
| | | param.put("enable_hls", enable_hls); |
| | | param.put("enable_mp4", enable_mp4); |
| | | param.put("ffmpeg_cmd_key", ffmpeg_cmd_key); |
| | | return sendPost("addFFmpegSource",param, null); |
| | | } |
| | | |
| | |
| | | } |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("api.secret",mediaConfig.getSecret()); // -profile:v Baseline |
| | | // param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s"); |
| | | param.put("ffmpeg.cmd","%s -fflags nobuffer -rtsp_transport tcp -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s"); |
| | | param.put("hook.enable","1"); |
| | | param.put("hook.on_flow_report",""); |
| | | param.put("hook.on_play",String.format("%s/on_play", hookPrex)); |
| | |
| | | * @return |
| | | */ |
| | | boolean stop(String app, String stream); |
| | | |
| | | /** |
| | | * 获取ffmpeg.cmd模板 |
| | | * @return |
| | | */ |
| | | JSONObject getFFmpegCMDs(); |
| | | } |
| | |
| | | param.isEnable_hls(), param.isEnable_mp4(), param.getRtp_type()); |
| | | }else if ("ffmpeg".equals(param.getType())) { |
| | | result = zlmresTfulUtils.addFFmpegSource(param.getSrc_url(), param.getDst_url(), |
| | | param.getTimeout_ms() + ""); |
| | | param.getTimeout_ms() + "", param.isEnable_hls(), param.isEnable_mp4(), |
| | | param.getFfmpeg_cmd_key()); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public JSONObject getFFmpegCMDs() { |
| | | JSONObject result = new JSONObject(); |
| | | JSONObject mediaServerConfigResuly = zlmresTfulUtils.getMediaServerConfig(); |
| | | if (mediaServerConfigResuly != null && mediaServerConfigResuly.getInteger("code") == 0 |
| | | && mediaServerConfigResuly.getJSONArray("data").size() > 0){ |
| | | JSONObject mediaServerConfig = mediaServerConfigResuly.getJSONArray("data").getJSONObject(0); |
| | | |
| | | for (String key : mediaServerConfig.keySet()) { |
| | | if (key.startsWith("ffmpeg.cmd")){ |
| | | result.put(key, mediaServerConfig.getString(key)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | |
| | | String dstUrl = String.format("rtmp://%s:%s/convert/%s", "127.0.0.1", mediaInfo.getRtmpPort(), |
| | | streamId ); |
| | | String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId); |
| | | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000"); |
| | | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000", true, false, null); |
| | | logger.info(jsonObject.toJSONString()); |
| | | JSONObject result = new JSONObject(); |
| | | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("获取ffmpeg.cmd模板") |
| | | @GetMapping(value = "/ffmpeg_cmd/list") |
| | | @ResponseBody |
| | | public WVPResult getFFmpegCMDs(){ |
| | | logger.debug("获取ffmpeg.cmd模板:" ); |
| | | JSONObject data = streamProxyService.getFFmpegCMDs(); |
| | | WVPResult<JSONObject> result = new WVPResult<>(); |
| | | result.setCode(0); |
| | | result.setMsg("success"); |
| | | result.setData(data); |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("移除代理") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), |
| | |
| | | </div> |
| | | <div v-if="!recordDetail"> |
| | | <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> |
| | | |
| | | |
| | | 节点选择: <el-select size="mini" @change="chooseMediaChange" style="width: 16rem; margin-right: 1rem;" v-model="mediaServer" placeholder="请选择" default-first-option> |
| | | <el-option |
| | | v-for="item in mediaServerList" |
| | |
| | | <el-form-item label="拉流地址" prop="src_url" v-if="proxyParam.type=='ffmpeg'"> |
| | | <el-input v-model="proxyParam.src_url" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="超时时间" prop="timeout_ms" v-if="proxyParam.type=='ffmpeg'"> |
| | | <el-form-item label="超时时间:秒" prop="timeout_ms" v-if="proxyParam.type=='ffmpeg'"> |
| | | <el-input v-model="proxyParam.timeout_ms" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="FFmpeg命令模板" prop="ffmpeg_cmd_key" v-if="proxyParam.type=='ffmpeg'"> |
| | | <el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></el-input> |
| | | <!-- <el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></el-input>--> |
| | | <el-select |
| | | v-model="proxyParam.ffmpeg_cmd_key" |
| | | style="width: 100%" |
| | | placeholder="请选择FFmpeg命令模板" |
| | | > |
| | | <el-option |
| | | v-for="item in Object.keys(ffmpegCmdList)" |
| | | :key="item" |
| | | :label="ffmpegCmdList[item]" |
| | | :value="item"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="国标编码" prop="gbId"> |
| | | <el-input v-model="proxyParam.gbId" placeholder="设置国标编码可推送到国标" clearable></el-input> |
| | |
| | | enable_mp4: false, |
| | | platformGbId: null, |
| | | }, |
| | | ffmpegCmdList:{}, |
| | | |
| | | rules: { |
| | | name: [{ required: true, message: "请输入名称", trigger: "blur" }], |
| | |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | }); |
| | | this.$axios({ |
| | | method: 'get', |
| | | url:`/api/proxy/ffmpeg_cmd/list` |
| | | }).then(function (res) { |
| | | that.ffmpegCmdList = res.data.data; |
| | | }).catch(function (error) { |
| | | console.log(error); |
| | | }); |
| | | }, |
| | | onSubmit: function () { |
| | | console.log("onSubmit"); |