thirtythreeforty / neolink

An RTSP bridge to Reolink IP cameras
https://www.thirtythreeforty.net/posts/2020/05/hacking-reolink-cameras-for-fun-and-profit/
GNU Affero General Public License v3.0
890 stars 148 forks source link

Substream not working on Argus Pro #320

Closed Morphy99 closed 1 year ago

Morphy99 commented 1 year ago

Describe the bug Substream doesn't appear to be working. I've tried enabling debug logging by opening a sh terminal in portainer with "set RUST_LOG=debug" but the only logs I get are:

[2022-11-12T20:17:09Z INFO  neolink] Neolink 0.4.0 (unknown commit) release
[2022-11-12T20:17:09Z WARN  neolink::rtsp] Without a server certificate, usernames and passwords will be exchanged in plaintext!
[2022-11-12T20:17:09Z INFO  neolink::rtsp] front: Connecting to camera at UID: myuuid
[2022-11-12T20:17:09Z INFO  neolink::rtsp] front: Logging in
[2022-11-12T20:17:09Z INFO  neolink::rtsp] front: Connecting to camera at UID: myuuid
[2022-11-12T20:17:09Z INFO  neolink::rtsp] front: Logging in
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Connected and logged in
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Starting video stream Sub Stream (Fluent)
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Connected and logged in
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Camera time is already set: 2022-11-12 20:17:12 +0
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Camera reports firmware version 1202_491_352_28
[2022-11-12T20:17:10Z INFO  neolink::rtsp] front: Starting video stream Main Stream (Clear)

To Reproduce Trying to playback url rtsp://un:pw@ip:8554/camera/substream results in "Failed to connect with rtsp://un:pw@ip:8554/camera/substream" error in VLC

Expected behavior Stream to play in VLC

Versions NVR software: Neolink software: 0.4.0 Reolink camera model and firmware: Argus Pro

QuantumEntangledAndy commented 1 year ago

Could you set GST_DEBUG=3 and post those logs while when you try to connect from vlc. Also I believe that case important so please try subStream instead of substream

Morphy99 commented 1 year ago

I noticed this after starting the container:

[2022-11-14T22:09:48Z INFO  neolink::rtsp] front: Starting video stream Main Stream (Clear)
0:00:08.745330131     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:1063:find_media: client 0x7f6cd106b110: not authorized for factory path /front
0:00:08.745423409     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:3376:handle_describe_request: client 0x7f6cd106b110: no media
0:00:08.776194839     6 0x7f6cd075b300 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<audsrc:src> 
Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:08.778113111     6 0x7f6cd075baa0 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<vidsrc:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:09.998943061     6 0x7f6cd10279e0 FIXME              rtspmedia rtsp-media.c:4584:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:00:10.003316007     6 0x7f6cd10279e0 FIXME              rtspmedia rtsp-media.c:4584:gst_rtsp_media_suspend: suspend for dynamic pipelines needs fixing
0:00:10.003376048     6 0x7f6cd10279e0 WARN               rtspmedia rtsp-media.c:4623:gst_rtsp_media_suspend: media 0x7f6cd07431b0 was not prepared
0:00:10.009321106     6 0x7f6cd1033b60 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<appsrc2:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:10.010840049     6 0x7f6cd10348c0 FIXME                default gstutils.c:4025:gst_pad_create_stream_id_internal:<appsrc3:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:10.011944389     6 0x7f6cd10279e0 FIXME              rtspmedia rtsp-media.c:2884:gst_rtsp_media_seek_trickmode:<GstRTSPMedia@0x7f6cd07431b0> Handle going back to 0 for none live not seekable streams.

Trying to connect (with subStream):

0:04:23.910934873     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:3093:handle_setup_request: client 0x7f6cd106b4d0: media '/front/substream' not found
0:04:27.140180000     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:1046:find_media: client 0x7f6cd106b250: no factory for path /front/substream
0:04:27.140278497     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:3376:handle_describe_request: client 0x7f6cd106b250: no media
0:04:27.145095638     6 0x7f6cd10279e0 ERROR             rtspclient rtsp-client.c:1063:find_media: client 0x7f6cd0fecbb0: not authorized for factory path /front/substream
QuantumEntangledAndy commented 1 year ago

It seems your setting usernames and passwords to connect to the rtsp stream. Perhaps you should debug without because from your logs it seems that your not supplying the correct passwords in the url.

Also your log still says media '/front/substream' rather than media '/front/subStream'. This could just be the way gst debug prints but please ensure you show the logs when it is in the subSteam case. Also what happens when you do just /front

Morphy99 commented 1 year ago

Sorry for the delay, life getting in the way again! Had another play this morning and it seems the substream isn't working when I define in a user in neolink.toml. The same credentials and player works fine for the normal stream (/front). When I remove the credentials from the config I can connect OK with substream.

QuantumEntangledAndy commented 1 year ago

Intersting. Well please provide the debug log with the environment variable I mentioned before. It should tell us what is not authenticating

Morphy99 commented 1 year ago

That is the debug log with GST_DEBUG=3 here

QuantumEntangledAndy commented 1 year ago

Are those the whole logs? I was expecting more such that revealed the login/auth stages of the client etc.

Morphy99 commented 1 year ago

FFS my bad. It does work with the subStream url. I'm not sure why, but my VLC changes the url to /front/substream despite me entering the correct one :angry: I've tested it with frigate which is what I'm using the stream with and it's working OK with the correct URL and authentication.