Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in SDP from Annke CZ400 (rebranded Hikvision DS-2DE2A404IW-DE3) #384

Closed
miguelangel-nubla opened this issue Apr 26, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@miguelangel-nubla
Copy link
Contributor

miguelangel-nubla commented Apr 26, 2023

When I set the camera to H265 I can't stream over MSE. Frigate stream works fine.
Have similar cameras (Annke C800) that work fine with H265, so it may be a camera specific bug?

Logs v1.4.0:

panic: runtime error: index out of range [0] with length 0

goroutine 53 [running]:
github.com/deepch/vdk/codec/h265parser.AVCDecoderConfRecord.Marshal({0x1, 0x60, 0x0, 0x3, {0xc0000085d0, 0x1, 0x1}, {0xc000008588, 0x1, 0x1}, ...}, ...)
        github.com/deepch/vdk@v0.0.19/codec/h265parser/parser.go:634 +0x65c
github.com/deepch/vdk/codec/h265parser.NewCodecDataFromVPSAndSPSAndPPS({_, _, _}, {_, _, _}, {_, _, _})
        github.com/deepch/vdk@v0.0.19/codec/h265parser/parser.go:515 +0x425
github.com/AlexxIT/go2rtc/pkg/mp4.(*Muxer).GetInit(0xc00008c6e0, {0xc00010d908, 0x1, 0xc00007eec0?})
        github.com/AlexxIT/go2rtc/pkg/mp4/muxer.go:93 +0x3bb
github.com/AlexxIT/go2rtc/pkg/mp4.(*Consumer).Init(0xc000128240)
        github.com/AlexxIT/go2rtc/pkg/mp4/consumer.go:181 +0xcd
github.com/AlexxIT/go2rtc/cmd/mp4.handlerWSMSE(0xc00058e000, 0xc000590000)
        github.com/AlexxIT/go2rtc/cmd/mp4/ws.go:47 +0x4b2
github.com/AlexxIT/go2rtc/cmd/api.apiWS.func2()
        github.com/AlexxIT/go2rtc/cmd/api/ws.go:111 +0x3f
created by github.com/AlexxIT/go2rtc/cmd/api.apiWS
        github.com/AlexxIT/go2rtc/cmd/api/ws.go:110 +0x398
@AlexxIT AlexxIT added the bug Something isn't working label Apr 26, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 26, 2023

Enable trace log level for rtsp module and show result

@miguelangel-nubla
Copy link
Contributor Author

15:15:14.034 INF go2rtc version 1.4.0 windows/amd64
15:15:14.036 INF [api] listen addr=:1984
15:15:14.037 INF [rtsp] listen addr=:8554
15:15:14.037 INF [srtp] listen addr=:8443
15:15:14.037 INF [webrtc] listen addr=:8555/tcp
15:15:17.979 TRC [rtsp] client request:
DESCRIBE rtsp://10.2.3.163:554/Streaming/Channels/1 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
User-Agent: go2rtc/1.4.0
CSeq: 1


15:15:17.981 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Date: Wed, Apr 26 2023 15:15:15 GMT
Cseq: 1
Www-Authenticate: Digest realm="IP Camera(F6945)", nonce="a3b2aed601606b002cb94a576fb575b7", stale="FALSE"


15:15:17.982 TRC [rtsp] client request:
DESCRIBE rtsp://10.2.3.163:554/Streaming/Channels/1 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
User-Agent: go2rtc/1.4.0
CSeq: 2
Authorization: Digest username="live", realm="IP Camera(F6945)", nonce="a3b2aed601606b002cb94a576fb575b7", uri="rtsp://10.2.3.163:554/Streaming/Channels/1", response="d6ce1c05d5a753bb40f641fe16215454"


15:15:17.986 TRC [rtsp] client response:
RTSP/1.0 200 OK
Content-Base: rtsp://10.2.3.163:554/Streaming/Channels/1/
Cseq: 2
Content-Type: application/sdp
Content-Length: 915

v=0
o=- 1682522115404208 1682522115404208 IN IP4 10.2.3.163
s=Media Presentation
e=NONE
b=AS:5150
t=0 0
a=control:rtsp://10.2.3.163:554/Streaming/Channels/1/
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:2560,1440
a=control:rtsp://10.2.3.163:554/Streaming/Channels/1/trackID=1
a=rtpmap:96 H265/90000
a=fmtp:96 sprop-sps=QgEBAWAAAAMAsAAAAwAAAwCZoAFAIAWhY2uSTL8AgAAAAwCAAAAKUIA=; sprop-pps=RAHA8vA8kAA=
m=audio 0 RTP/AVP 14
c=IN IP4 0.0.0.0
b=AS:50
a=recvonly
a=control:rtsp://10.2.3.163:554/Streaming/Channels/1/trackID=2
a=rtpmap:14 MPA/90000
m=audio 0 RTP/AVP 0 102
a=rtpmap:0 PCMU/8000
a=rtpmap:102 G726/8000
c=IN IP4 0.0.0.0
b=AS:50
a=sendonly
a=control:rtsp://10.2.3.163:554/Streaming/Channels/1/trackID=4
a=rtpmap:14 MPA/90000
a=Media_header:MEDIAINFO=494D4B48010300000400050000200110007D000000F4010000000000000000000000000000000000;
a=appversion:1.0

15:15:17.987 TRC [rtsp] client request:
SETUP rtsp://10.2.3.163:554/Streaming/Channels/1/trackID=1 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3
Authorization: Digest username="live", realm="IP Camera(F6945)", nonce="a3b2aed601606b002cb94a576fb575b7", uri="rtsp://10.2.3.163:554/Streaming/Channels/1/trackID=1", response="0d201fd9344150f28a8f8ddb814a412e"


15:15:17.994 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Session: 1896739839;timeout=60
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=579f3537;mode="play"
Date: Wed, Apr 26 2023 15:15:15 GMT


15:15:17.994 TRC [rtsp] client request:
PLAY rtsp://10.2.3.163:554/Streaming/Channels/1/ RTSP/1.0
CSeq: 4
Authorization: Digest username="live", realm="IP Camera(F6945)", nonce="a3b2aed601606b002cb94a576fb575b7", uri="rtsp://10.2.3.163:554/Streaming/Channels/1/", response="3845402294f1a9c2cc963f34074ce545"
Session: 1896739839


panic: runtime error: index out of range [0] with length 0

goroutine 82 [running]:
github.com/deepch/vdk/codec/h265parser.AVCDecoderConfRecord.Marshal({0x1, 0x60, 0x0, 0x3, {0xc000008960, 0x1, 0x1}, {0xc000008930, 0x1, 0x1}, ...}, ...)
        github.com/deepch/vdk@v0.0.19/codec/h265parser/parser.go:634 +0x65c
github.com/deepch/vdk/codec/h265parser.NewCodecDataFromVPSAndSPSAndPPS({_, _, _}, {_, _, _}, {_, _, _})
        github.com/deepch/vdk@v0.0.19/codec/h265parser/parser.go:515 +0x425
github.com/AlexxIT/go2rtc/pkg/mp4.(*Muxer).GetInit(0xc00008c780, {0xc00000a638, 0x1, 0xc00007f120?})
        github.com/AlexxIT/go2rtc/pkg/mp4/muxer.go:93 +0x3bb
github.com/AlexxIT/go2rtc/pkg/mp4.(*Consumer).Init(0xc000298240)
        github.com/AlexxIT/go2rtc/pkg/mp4/consumer.go:181 +0xcd
github.com/AlexxIT/go2rtc/cmd/mp4.handlerWSMSE(0xc00008cfa0, 0xc00007f920)
        github.com/AlexxIT/go2rtc/cmd/mp4/ws.go:47 +0x4b2
github.com/AlexxIT/go2rtc/cmd/api.apiWS.func2()
        github.com/AlexxIT/go2rtc/cmd/api/ws.go:111 +0x3f
created by github.com/AlexxIT/go2rtc/cmd/api.apiWS
        github.com/AlexxIT/go2rtc/cmd/api/ws.go:110 +0x398

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 27, 2023

OK. Wrong response from camera. Will fix it

@AlexxIT AlexxIT changed the title Annke CZ400 (rebranded Hikvision DS-2DE2A404IW-DE3) H265 over MSE stream crashing Fix bug in SDP from Annke CZ400 (rebranded Hikvision DS-2DE2A404IW-DE3) Apr 27, 2023
AlexxIT added a commit that referenced this issue Apr 27, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 27, 2023

Fixed in latest master version. Will be in next release

@AlexxIT
Copy link
Owner

AlexxIT commented May 4, 2023

@AlexxIT AlexxIT closed this as completed May 4, 2023
@Mincka
Copy link

Mincka commented Jun 8, 2023

Could you release an update of WebRTC Camera to benefit from v1.5.0 fixes on the HA card? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants