看最近的访问搜索关键字,大部分都是通过WVP-GB28181关键字搜索过来的,原来调到一半,就去干别的事情了,趁着年前比较空闲,重新捡起来,发现还比较顺利的调通了取流,记录下过程。
pjsip客户端注册到wvp sip服务器的default.config配置文件。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # This is a comment in the config file. #--id sip: 44010200491110000001 @ 47.105 . 47.160 : 5061 ;transport=tcp #--registrar sip: 47.105 . 47.160 : 5061 ;transport=tcp #--realm 3402000000 --id sip: 41010500002000000002 @ 4101050000 --registrar sip: 4101050000 --proxy=sip: 192.168 . 16.213 : 8116 --realm 4101050000 --username 41010500002000000002 --password 12345678 --local-port= 5066 #--auto-loop --clock-rate 16000 --ptime 20 #-- null -audio #--ip-addr= 192.168 . 16.99 #log-config --log-level= 6 #--log-file=log/siplog --auto-answer 200 #video --video --vcapture-dev 0 #webrtc echo --ec-opt= 3 #--stereo --ec-tail= 75 #register --reg-timeout= 120 |
WVP的配置文件错误,导致取流一直报“未找到可用的zlm”,主要是application.yml配置文件中zlm的id配置不正确。
media:
#media-server-Id
id: f5pIoX4tqRzE7TI0
media-server-Id是config.ini文件中的mediaServerId
1 2 3 4 5 6 7 8 9 10 11 12 | [general] addMuteAudio=1 check_nvidia_dev=1 continue_push_ms=15000 enableVhost=0 enable_audio=1 enable_ffmpeg_log=0 flowThreshold=1024 fmp4_demand=0 hls_demand=0 maxStreamWaitMS=15000 mediaServerId=f5pIoX4tqRzE7TI0 |
取流报500错误:
1 2 3 4 5 6 7 8 | 2024-02-06 17:17:29.103 ERROR --- GlobalExceptionHandler : [鍏ㄥ眬寮傚父]锛? java.lang.NullPointerException: null at com.genersoft.iot.vmp.service.impl.PlayServiceImpl.play(PlayServiceImpl.java:119) at com.genersoft.iot.vmp.vmanager.gb28181.play.PlayController.play(PlayController.java:124) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) |
修改PlayServiceImpl.java:119行,重新编译:
1 2 3 4 5 6 7 8 9 10 | 修改前: if (device.getStreamMode().equalsIgnoreCase( "TCP-ACTIVE" ) && !mediaServerItem.isRtpEnable()) { logger.warn( "[点播] 单端口收流时不支持TCP主动方式收流 deviceId: {},channelId:{}" , deviceId, channelId); throw new ControllerException(ErrorCode.ERROR100.getCode(), "单端口收流时不支持TCP主动方式收流" ); } 修改后: if (device != null && device.getStreamMode() != null && device.getStreamMode().equalsIgnoreCase( "TCP-ACTIVE" ) && !mediaServerItem.isRtpEnable()) { logger.warn( "[点播] 单端口收流时不支持TCP主动方式收流 deviceId: {},channelId:{}" , deviceId, channelId); throw new ControllerException(ErrorCode.ERROR100.getCode(), "单端口收流时不支持TCP主动方式收流" ); } |
终于是看到视频了,下一步,继续分析源代码。
从ZLM查看到的日志:WVP向zlm申请了一个rtp的端口,然后将这个端口转发给了国标摄像头,然后zlm接收到推流后,通知到WVP,界面显示刷新。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | POST /index/api/getRtpInfo # header: Accept-Encoding : gzip Connection : Keep-Alive Content-Length : 95 Content-Type : application/x-www-form-urlencoded Host : 192.168.16.83:8080 User-Agent : okhttp/4.10.0 # content: secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&stream_id=41010500002000000002_41010500002000000002 # response: { "code" : 0, "exist" : false } 2024-02-06 17:31:50.264 I [MediaServer] [665-event poller 0] Rtsp.cpp:440 getPortPair | got port from pool:50002-50003 2024-02-06 17:31:50.264 D [MediaServer] [665-event poller 0] WebApi.cpp:250 http api debug | # request: POST /index/api/openRtpServer # header: Accept-Encoding : gzip Connection : Keep-Alive Content-Length : 127 Content-Type : application/x-www-form-urlencoded Host : 192.168.16.83:8080 User-Agent : okhttp/4.10.0 # content: secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&re_use_port=0&stream_id=41010500002000000002_41010500002000000002&port=0&tcp_mode=0 # response: { "code" : 0, "port" : 50002 } 2024-02-06 17:31:50.440 D [MediaServer] [665-event poller 0] WebApi.cpp:250 http api debug | # request: POST /index/api/getMediaList # header: Accept-Encoding : gzip Connection : Keep-Alive Content-Length : 123 Content-Type : application/x-www-form-urlencoded Host : 192.168.16.83:8080 User-Agent : okhttp/4.10.0 # content: secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&app=rtp&vhost=__defaultVhost__&stream=41010500002000000002_41010500002000000002 # response: { "code" : 0 } 2024-02-06 17:31:52.456 D [MediaServer] [665-event poller 0] WebHook.cpp:201 operator() | hook http: //192.168.16.213:8089/index/hook/on_publish 2020ms,success:{ "app" : "rtp" , "id" : "41010500002000000002_41010500002000000002" , "ip" : "192.168.16.213" , "mediaServerId" : "f5pIoX4tqRzE7TI0" , "originType" : 3, "originTypeStr" : "rtp_push" , "params" : "" , "port" : 4002, "schema" : "rtp" , "stream" : "41010500002000000002_41010500002000000002" , "vhost" : "__defaultVhost__" } 2024-02-06 17:31:44.686 W [MediaServer] [665-event poller 0] WebHook.cpp:188 operator() | hook http: //127.0.0.1:18081/api/record/on_record_mp4 14ms,failed[network err]:3(connection refused):{ "app" : "rtp" , "file_name" : "17-30-11-0.mp4" , "file_path" : "/home/OV500/LB/zlm/bin/www/record/rtp/41010500002000000002_41010500002000000002/2024-02-06/17-30-11-0.mp4" , "file_size" : 679851, "folder" : "/home/OV500/LB/zlm/bin/www/record/rtp/41010500002000000002_41010500002000000002/" , "mediaServerId" : "f5pIoX4tqRzE7TI0" , "start_time" : 1707211811, "stream" : "41010500002000000002_41010500002000000002" , "time_len" : 98.599998474121094, "url" : "record/rtp/41010500002000000002_41010500002000000002/2024-02-06/17-30-11-0.mp4" , "vhost" : "__defaultVhost__" } 结束的时候关闭rtp端口: 2024-02-06 17:32:19.326 D [MediaServer] [665-event poller 0] WebApi.cpp:250 http api debug | # request: POST /index/api/closeRtpServer # header: Accept-Encoding : gzip Connection : Keep-Alive Content-Length : 95 Content-Type : application/x-www-form-urlencoded Host : 192.168.16.83:8080 User-Agent : okhttp/4.10.0 # content: secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc&stream_id=41010500002000000002_41010500002000000002 # response: { "code" : 0, "hit" : 1 } |
-------------------广告线---------------
项目、合作,欢迎勾搭,邮箱:promall@qq.com
本文为呱牛笔记原创文章,转载无需和我联系,但请注明来自呱牛笔记 ,it3q.com