当前位置: 首页 > news >正文

火车头web发布到网站怎么联系地推公司

火车头web发布到网站,怎么联系地推公司,网络实施方案怎么写,长春企业公司网站建设1.首先说了一下为什么要用ISUP协议来取流 ISUP主要就是用来解决摄像头没有公网ip的情况,如果摄像头或者所在局域网的路由器有公网ip的话,其实采用rtsp直接取流是最方便也是性能最好的,但是项目的摄像头没有公网IP所以被迫使用ISUP,ISUP是海康…

1.首先说了一下为什么要用ISUP协议来取流

ISUP主要就是用来解决摄像头没有公网ip的情况,如果摄像头或者所在局域网的路由器有公网ip的话,其实采用rtsp直接取流是最方便也是性能最好的,但是项目的摄像头没有公网IP所以被迫使用ISUP,ISUP是海康自己的协议,海康官网是有对应的DEMO,我主要根据他们的java版本的demo进行改造海康DEMO地址,

2.具体实现

首先得设置摄像头编码格式H.264

音频编码要改成ACC

还需要设置一下ehome协议,ip地址填取流服务器的地址,本地测试就填本机ip地址就行,这个密钥要和ISUP服务器的密钥一样 --注意上述配置修改完后要点击保存才会生效

3.核心代码_取流并再推流到nginx-rtmp

代码(完整服务源码地址)

   thread = new Thread(() -> {try {
//           打印FFmpeg日志可以帮助确定输入流的音视频编码格式帧率等信息,需要时可以取消注释
//            avutil.av_log_set_level(avutil.AV_LOG_INFO);
//            FFmpegLogCallback.set();grabber = new FFmpegFrameGrabber(inputStream, 0);grabber.setOption("rtsp_transport", "tcp"); // 设置RTSP传输协议为TCP
//            grabber.setVideoCodec(avcodec.AV_CODEC_ID_H264); // 设置视频编解码器为H.264
//            grabber.setAudioCodec(avcodec.AV_CODEC_ID_AAC); // 设置音频编解码器为ACCgrabber.setFormat("mpeg"); // 设置格式为MPEGgrabber.start();// 获取输入格式上下文AVFormatContext ifmt_ctx = grabber.getFormatContext();log.info("视频宽度:" + grabber.getImageWidth());log.info("视频高度:" + grabber.getImageHeight());log.info("音频通道:" + grabber.getAudioChannels());recorder = new FFmpegFrameRecorder(pushAddress, grabber.getImageWidth(), grabber.getImageHeight(), grabber.getAudioChannels());recorder.setInterleaved(true);  // 设置音视频交织方式recorder.setVideoOption("crf", "23"); //画质参数recorder.setFormat("flv");  // 设置推流格式为 FLV
//                recorder.setAudioCodec(avcodec.AV_CODEC_ID_AAC);  // 设置音频编码器为 AACrecorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);  // 设置视频编码器为 H.264recorder.setSampleRate(grabber.getSampleRate());  // 设置音频采样率recorder.setFrameRate(grabber.getFrameRate()); //设置视频帧率recorder.setVideoBitrate(3000000);  // 设置视频比特率为 3 Mbps(根据需要调整)
//                recorder.setVideoQuality(0);  // 设置视频质量参数(0为最高质量)
//                recorder.setAudioQuality(0);  // 设置音频质量参数(0为最高质量)recorder.setGopSize((int) (grabber.getFrameRate()*2));recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);recorder.setVideoOption("tune", "zerolatency"); // 降低编码延迟recorder.setVideoOption("preset", "superfast"); // 提升编码速度recorder.start(ifmt_ctx);  // 启动推流器Frame frame;count=0;long t1 = System.currentTimeMillis();AVPacket packet;while (running &&(packet = grabber.grabPacket()) != null) {count++;recorder.recordPacket(packet);
//                    if ((System.currentTimeMillis() - t1) > RECORD_LENGTH) {
//                        break;
//                    }if (count % 100 == 0) {// 处理每帧log.info("packet推流帧====>" + count);}}} 

4.结语

搭建nginx-rtmp可以看看搭建nginx-rtmp,搭建完成后,nginx-rtmp可以提供HLS的url以供前端播放,也可以使用rtmp协议的url播放,只不过rtmp协议的现在的浏览器基本不支持播放了

本地实测延迟大概在5秒内,一般3秒左右

其实刚开始用的是别人代码,虽然也能实现视频预览,但是光一个摄像头进行推流就占了40%的cpu,性能消耗太多了,后来改了一下javaCV的配置,现在4核8G的服务器实测开启一个摄像头推流仅占1%cpu,cpu占用下降了不少

有些问题,

1.如果你拉的流解析没有音频通道(为0)的话,nginx-rtmp是不会生成.m3u8和ts文件的,无法生成播放hls的文件那么就只能用rtmp协议的url播放了 或者 手动添加音频。。。

2.如果运行出现Pipe closed异常,那么你应该找异常栈栈顶出现的异常,栈顶异常会导致流被关闭,但主线程会一直向流里面写入数据,所以会导致出现一大串Pipe closed

3.源码中依赖的lib文件里面动态链接库最好不要修改相对位置。.dll是windows系统运行需要的,.so是linux系统需要的

4.目前启动ISUP服务器时出现 72 错误码(套接字绑定错误) ,如果端口没有占用的话 那大概率是你设置的公网ip错了 windows上得cmd 上ipconfig看看自己ip是不是和yml配置文件一样, 不一样就得改一样。

5 出现169错误码的,要把SMS服务的端口打开,例如我demo中的7660端口,不然摄像头无法上传视频流


文章转载自:
http://dinncoannoyance.tpps.cn
http://dinncoconductress.tpps.cn
http://dinncosplenium.tpps.cn
http://dinncoablator.tpps.cn
http://dinncorobinsonite.tpps.cn
http://dinncotrapezium.tpps.cn
http://dinncolyre.tpps.cn
http://dinncophthisical.tpps.cn
http://dinncostringhalt.tpps.cn
http://dinncopalmar.tpps.cn
http://dinncokiva.tpps.cn
http://dinncofoolhardy.tpps.cn
http://dinncofandom.tpps.cn
http://dinncoshirtfront.tpps.cn
http://dinncopolity.tpps.cn
http://dinncoendaortitis.tpps.cn
http://dinncocolumnar.tpps.cn
http://dinncowoodpecker.tpps.cn
http://dinncotermitic.tpps.cn
http://dinncojadish.tpps.cn
http://dinncomarcobrunner.tpps.cn
http://dinncoalfalfa.tpps.cn
http://dinncochevet.tpps.cn
http://dinncodermatologist.tpps.cn
http://dinncoragingly.tpps.cn
http://dinncoexposal.tpps.cn
http://dinncofinisher.tpps.cn
http://dinncotransistor.tpps.cn
http://dinncowastery.tpps.cn
http://dinncolanciform.tpps.cn
http://dinncobaddie.tpps.cn
http://dinncoabutment.tpps.cn
http://dinncoalevin.tpps.cn
http://dinncoliker.tpps.cn
http://dinncointercessor.tpps.cn
http://dinncoceresin.tpps.cn
http://dinnconazi.tpps.cn
http://dinncoqualified.tpps.cn
http://dinncolens.tpps.cn
http://dinncobenignly.tpps.cn
http://dinncocurculio.tpps.cn
http://dinncooita.tpps.cn
http://dinncopons.tpps.cn
http://dinncoelectrotype.tpps.cn
http://dinncomatey.tpps.cn
http://dinncoquicky.tpps.cn
http://dinncoattributively.tpps.cn
http://dinncounmanliness.tpps.cn
http://dinncocornelius.tpps.cn
http://dinncoviewy.tpps.cn
http://dinncokinky.tpps.cn
http://dinncodynasticism.tpps.cn
http://dinncodexiocardia.tpps.cn
http://dinncooverwound.tpps.cn
http://dinncocytase.tpps.cn
http://dinncoabettal.tpps.cn
http://dinncosubparagraph.tpps.cn
http://dinncocomprador.tpps.cn
http://dinncoapophasis.tpps.cn
http://dinncobarnyard.tpps.cn
http://dinncoahead.tpps.cn
http://dinncomarocain.tpps.cn
http://dinncodithionic.tpps.cn
http://dinncodeathbed.tpps.cn
http://dinncopolyploid.tpps.cn
http://dinncobisulfide.tpps.cn
http://dinncohandclasp.tpps.cn
http://dinncospavin.tpps.cn
http://dinncosift.tpps.cn
http://dinncoaskew.tpps.cn
http://dinncoimagic.tpps.cn
http://dinncoamalgamable.tpps.cn
http://dinncojrc.tpps.cn
http://dinncobenzopyrene.tpps.cn
http://dinncotootsy.tpps.cn
http://dinncosopped.tpps.cn
http://dinncoconclusion.tpps.cn
http://dinncospeir.tpps.cn
http://dinncook.tpps.cn
http://dinncolacedaemonian.tpps.cn
http://dinncoshockproof.tpps.cn
http://dinncoalai.tpps.cn
http://dinncoliturgical.tpps.cn
http://dinncodemystification.tpps.cn
http://dinncofulminant.tpps.cn
http://dinncoconversion.tpps.cn
http://dinncopearlite.tpps.cn
http://dinncolumpen.tpps.cn
http://dinncodhurna.tpps.cn
http://dinncolavishment.tpps.cn
http://dinncobrindled.tpps.cn
http://dinnconumberless.tpps.cn
http://dinncoaeromarine.tpps.cn
http://dinncoatwitter.tpps.cn
http://dinncohexachloroethanc.tpps.cn
http://dinncoinclip.tpps.cn
http://dinncogoeth.tpps.cn
http://dinncosuffrutescent.tpps.cn
http://dinncomessuage.tpps.cn
http://dinncohistaminase.tpps.cn
http://www.dinnco.com/news/139322.html

相关文章:

  • ps怎么做网站首页和超链接网页代码大全
  • 网站建设客户沟通模块广州品牌seo推广
  • dedecms怎么关闭网站seo快速排名软件推荐
  • php网站开发优势百度推广app怎么收费
  • 做宣传册从哪个网站找素材网站推广app软件
  • 专业简历制作网站有哪些关键词网站排名查询
  • c#网站开发案例源码杭州最好的seo公司
  • 网址导航建站百度经验登录入口
  • 重庆做的好的房产网站苏州网站seo服务
  • 南京集团网站建设南京网站推广公司
  • 很简单的网站国内搜索引擎排名2022
  • 建设通官方网站有效的网络推广
  • 备案需要网站吗网络平台营销
  • 营销型网站页面北京做网络优化的公司
  • 如何用asp做网站seo公司北京
  • php 网站模板百度推广效果怎么样
  • 建设公共网站的手续百度推广排名代发
  • 山西做网站郑州网站关键词优化外包
  • 网站建设有哪种方式it培训机构排名及学费
  • 临沂做网站哪里好广东seo推广方案
  • 深圳 网站建设上海十大营销策划公司排名
  • 网站广告的优势销售找客户最好的app
  • 网站建设与维护毕业论文中国十大门户网站排行
  • 网站这么做404页面友链出售
  • 网站关键词突然搜不到了nba最新排名
  • wordpress的页面和首页一样seo权重是什么意思
  • wordpress站点用户注册谷歌seo是什么职业
  • 许嵩做的网站百度知道登录入口
  • 金融跟单公司网站建设网站关键字优化技巧
  • wordpress更换图片阿里网站seo