Firefly开源社区

标题: ffmedia获取海康门禁rtsp流报错 [打印本页]

作者: sky-brid    时间: 2024-9-20 17:02
标题: ffmedia获取海康门禁rtsp流报错
使用ffmedia获取海康摄像头的rtsp流
对于普通摄像头可以正常获取rtsp流,并正常显示
对于海康的门禁摄像头,尝试获取rtsp流,ffmedia报错,无法获取rtsp流
tchip_askquestions

error.zip

809 Bytes, 下载次数: 0, 下载积分: 灯泡 -1 , 经验 -1


作者: sky-brid    时间: 2024-9-24 16:51
本帖最后由 sky-brid 于 2024-9-24 16:52 编辑

INFO: ff_media: connectToServer: connected to server 192.168.10.51:554
WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
INFO: 16ModuleRtspClient: init: rtsp para w h: 1280 720, ws hs: 1280 720, format: H264
rga_api version 1.3.0_[0] (RGA is compiling with meson base: $PRODUCT_BASE)
ERROR: 10RTSPClient: getOutputDataTimeOut: wait for session to get buffer time out
ERROR: 10RTSPClient: getOutputDataTimeOut: wait for session to get buffer time out
ERROR: 12ModuleMppDec: work: wait for productor ModuleRtspClient timeout
ERROR: 9ModuleRga: work: wait for productor ModuleMppDec timeout
ERROR: 11ModuleMedia: work: wait for productor ModuleRga timeout
ERROR: 10RTSPClient: getOutputDataTimeOut: wait for session to get buffer time out
ERROR: 10RTSPClient: getOutputDataTimeOut: wait for session to get buffer time out
报错401连接错误,是否是权限不够或者门禁摄像头自带防火墙
使用OpenCV和FFmpeg都可以正常获取到门禁摄像头的rtsp流

作者: dengkx    时间: 2024-9-25 11:12
sky-brid 发表于 2024-9-24 16:51
INFO: ff_media: connectToServer: connected to server 192.168.10.51:554
WARN: ff_media: sendOptionsC ...

可尝试切换udp或tcp协议试试看?
作者: sky-brid    时间: 2024-9-25 17:12
本帖最后由 sky-brid 于 2024-9-25 17:47 编辑

试了一下udp或者tcp协议,发现获取门禁摄像头的rtsp流时还是会报401错误,
但是获取普通摄像头的rtsp流同样的程序是正常的

作者: dengkx    时间: 2024-9-26 09:53
sky-brid 发表于 2024-9-25 17:12
试了一下udp或者tcp协议,发现获取门禁摄像头的rtsp流时还是会报401错误,
但是获取普通摄像头的rtsp流同 ...

ff_log_level=5 ./demo rtsp://xxx
增加打印等级再运行看看,看rtsp log下
作者: sky-brid    时间: 2024-9-26 18:26
dengkx 发表于 2024-9-26 09:53
ff_log_level=5 ./demo rtsp://xxx
增加打印等级再运行看看,看rtsp log下

Firefly FFMedia: v2.2.2-2-gd5f6977
INFO: ff_media: start_instance:

==========================================
INFO: ff_media: start_instance: enable rtsp client
INFO: ff_media: connectToServer: connected to server 192.168.10.52:554
DEBUG: ff_media: sendRequest: Sending Request:
OPTIONS rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 1
User-Agent: FFMediaPlayer


DEBUG: ff_media: getResponse: Received OPTIONS response:
RTSP/1.0 401 Unauthorized
CSeq: 1
WWW-Authenticate: Digest realm="Hikvision", nonce="955e533261a58fda62a87d9671d7b44a", random="1yjHWTNZEeEV4Mo4QLq32NwVGupiaba6zZaou9BmhgfYw0u4+z9/MNQv/dqTQKTH", stale="FALSE"
WWW-Authenticate: Basic realm="/"


WARN: ff_media: sendOptionsCmd: cannot handle OPTIONS response: RTSP/1.0 401 Unauthorized
DEBUG: ff_media: sendRequest: Sending Request:
OPTIONS rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 2
Authorization: Digest username="admin", realm="Hikvision", nonce="955e533261a58fda62a87d9671d7b44a", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="aefffb0f27ef28ec4af62f662d8040f1"
User-Agent: FFMediaPlayer


DEBUG: ff_media: getResponse: Received OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE


DEBUG: ff_media: sendRequest: Sending Request:
DESCRIBE rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 3
Accept: application/sdp


DEBUG: ff_media: getResponse: Received DESCRIBE response:
RTSP/1.0 401 Unauthorized
CSeq: 3
WWW-Authenticate: Digest realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", random="pAEGJwzKFQOYJWCFZlK0Jpr1xuEHqteBvn947DE0oQosgsp87Ozv9NtkqhKo2T8p", stale="FALSE"
WWW-Authenticate: Basic realm="/"


DEBUG: ff_media: describeURL: cannot handle DESCRIBE response: RTSP/1.0 401 Unauthorized
DEBUG: ff_media: sendRequest: Sending Request:
DESCRIBE rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 4
Accept: application/sdp
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="3b2a76a5be29665808e22bcaa3227f99"


DEBUG: ff_media: getResponse: Received DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 4
Content-Type: application/sdp
Content-Length: 522


DEBUG: ff_media: describeURL: Need to read 522 extra bytes
DEBUG: ff_media: describeURL: Read 522 extra bytes:
v=0
o=- 1109162014219182 0 IN IP4 0.0.0.0
s=HIK Media Server
i=HIK Media Server Session Description : standard
e=NONE
c=IN IP4 0.0.0.0
t=0 0
a=control:*
a=range:npt=0.0-
m=video 0 RTP/AVP 96
i=Video Media
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=4D0014;packetization-mode=0
a=control:trackID=1
m=audio 0 RTP/AVP 0
i=Audio Media
a=rtpmap:0 PCMU/8000
a=control:trackID=2
a=Media_header:MEDIAINFO=494D4B48010100000400000110710110401F000000FA000000000000000000000000000000000000;
a=appversion:1.0

INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
DEBUG: ff_media: sendRequest: Sending Request:
SETUP rtsp://192.168.10.52:554/h264/ch1/main/av_stream/trackID=1 RTSP/1.0
CSeq: 5
Transport: RTP/AVP;unicast;client_port=10000-10001
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="3c9e913a81488b1137eca11233dcd50b"
User-Agent: FFMediaPlayer


DEBUG: ff_media: getResponse: Received SETUP response:
RTSP/1.0 200 OK
Session: 1970377611
Transport: RTP/AVP;unicast;client_port=10000-10001;server_port=62304-62305;ssrc=7571938b
CSeq: 5


INFO: ff_media: RTPSource: RTPSock current buffer size is(425984)
DEBUG: ff_media: sendRequest: Sending Request:
SETUP rtsp://192.168.10.52:554/h264/ch1/main/av_stream/trackID=2 RTSP/1.0
CSeq: 6
Transport: RTP/AVP;unicast;client_port=10002-10003
Session: 1970377611
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="3c9e913a81488b1137eca11233dcd50b"
User-Agent: FFMediaPlayer


DEBUG: ff_media: getResponse: Received SETUP response:
RTSP/1.0 200 OK
Session: 1970377611
Transport: RTP/AVP;unicast;client_port=10002-10003;server_port=62306-62307;ssrc=7571938c
CSeq: 6


DEBUG: ff_media: sendRequest: Sending Request:
PLAY rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 7
Session: 1970377611
Range: npt=0.000-
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="375d96df227f16f5bac8e3b8520da783"
User-Agent: FFMediaPlayer


DEBUG: ff_media: getResponse: Received PLAY response:
RTSP/1.0 200 OK
Session: 1970377611
CSeq: 7


DEBUG: 11VideoBuffer: allocBuffer: buffer size = 4194304
DEBUG: ff_media: rtpReadHandler: pt: 96, seqnum: 34353, ts: 2671153936, mk: 0, ts diff: 2671153936, len: 44
DEBUG: ff_media: processFrame: nal_type: 7, size: 29
DEBUG: ff_media: rtpReadHandler: pt: 96, seqnum: 34354, ts: 2671153936, mk: 0, len: 16
DEBUG: ff_media: processFrame: nal_type: 8, size: 4
DEBUG: ff_media: rtpReadHandler: pt: 96, seqnum: 34355, ts: 2671153936, mk: 0, len: 1400
DEBUG: ff_media: processFrame: nal_type: 28, size: 1388
DEBUG: ff_media: processFrame: nal_type: 28, size: 719
DEBUG: ff_media: rtpReadHandler: pt: 96, seqnum: 34472, ts: 2671157536, mk: 0, ts diff: 3600, len: 1400
DEBUG: ff_media: processFrame: nal_type: 28, size: 1388
DEBUG: ff_media: rtpReadHandler: pt: 96, seqnum: 34473, ts: 2671157536, mk: 1, len: 764
DEBUG: ff_media: processFrame: nal_type: 28, size: 751
DEBUG: ff_media: sendRequest: Sending Request:
PAUSE rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 8
Session: 1970377611
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="589e96acd7b0ebd4acf2a2fa4b1de03e"
User-Agent: FFMediaPlayer

INFO: 16ModuleRtspClient: init: rtsp para w h: 1280 720, ws hs: 1280 720, format: H264
DEBUG: 11VideoBuffer: allocBuffer: buffer size = 921600
DEBUG: ff_media: parseRTSPMessage: Received 44 bytes response:
RTSP/1.0 405 Method Not Allowed
CSeq: 8

DEBUG: 11VideoBuffer: allocBuffer: buffer size = 1966080
INFO: ff_media: start_instance:
Input Source:   rtsp://admin:jx123456@192.168.10.52:554/h264/ch1/main/av_stream
Input format:   1280x720 H264
Output format:  1280x720 NV12
Encode type:    H264
Decoder:        enable
Rga:            disable
Encoder:        disable
RtspClient:     enable
File writer:    disable
File:           disable
Rtsp push:      disable
==================Pipe===================
VERBOSE: 12ModuleMppDec: work: Wait for Productor: ModuleRtspClient
ModuleRtspClient (H264 1280x720)
   |--->ModuleMppDec (NV12 1280x720)

DEBUG: ff_media: sendRequest: Sending Request:
PLAY rtsp://192.168.10.52:554/h264/ch1/main/av_stream RTSP/1.0
CSeq: 9
Session: 1970377611
Range: npt=0.000-
Authorization: Digest username="admin", realm="Hikvision", nonce="d9460b154a1071a846bf4de9ffbc16a1", uri="rtsp://192.168.10.52:554/h264/ch1/main/av_stream", response="375d96df227f16f5bac8e3b8520da783"
User-Agent: FFMediaPlayer


DEBUG: ff_media: parseRTSPMessage: Received 249 bytes response:
RTSP/1.0 401 Unauthorized
CSeq: 9
WWW-Authenticate: Digest realm="Hikvision", nonce="62d78695d6a3b6137a6c9b0d6699eeb6", random="OtnhGrF+5c6aPmPeC8BWDdNF4EeXaBZlsmR1RwjQUDDniyBG5O5rX/GVDtKNuXh2", stale="FALSE"
WWW-Authenticate: Basic realm="/"


ERROR: 10RTSPClient: getOutputDataTimeOut: wait for session to get buffer time out
DEBUG: 16ModuleRtspClient: work: Produce empty

作者: dengkx    时间: 2024-9-26 19:23
本帖最后由 dengkx 于 2024-9-26 19:25 编辑

这看着是rtsp服务器的问题,第一次发送播放命令,正常获取流,然后发送暂停后,再次发送播放命令,rtsp服务器不支持了,所以导致后面无法获取视频流
作者: sky-brid    时间: 2024-9-27 14:06
dengkx 发表于 2024-9-26 19:23
这看着是rtsp服务器的问题,第一次发送播放命令,正常获取流,然后发送暂停后,再次发送播放命令,rtsp服务 ...

那请问一下ffmedia如何修改能解决这个问题啊,因为我试了用OpenCV和FFmpeg获取这个rtsp流是好的,但是这2种方法都没法调用硬件加速。




欢迎光临 Firefly开源社区 (https://dev.t-firefly.com/) Powered by Discuz! X3.1