QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
297 stars 44 forks source link

Reolink Argus PT wont connect #73

Closed buccaneeruk closed 1 year ago

buccaneeruk commented 1 year ago

Trying to get the above cams working through neolink sometimes the connection works but streaming never occurs. other times the connection fails stating the camera refused connection

gc@scs:~/neolink $ ./neolink rtsp --config=conf.toml
[2023-04-23T11:02:37Z INFO  neolink] Neolink fb4a23a1f641523dd79bd18630fa89b1e0360fbb release
[2023-04-23T11:02:37Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T11:02:37Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T11:02:37Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2023-04-23T11:02:40Z INFO  neolink_core::bc_protocol] Rear: Relay success xxxxxxxxxxx at 20.xxx.xxx.191:51378
[2023-04-23T11:02:53Z ERROR neolink::rtsp] Rear: Fatal error: Rear: Could not login to camera

    Caused by:
        0: IO Error: Custom { kind: Other, error: CameraTerminate }
        1: Camera terminated the connection
Error: Rear: Could not login to camera

Caused by:
    0: IO Error: Custom { kind: Other, error: CameraTerminate }
    1: Camera terminated the connection

Config:

bind = "0.0.0.0"

[[cameras]]
name = "Rear"
username = "admin"
password = "xxxxxxxxxxxxxxxxxxxxxx"
uid = "xxxxxxxxxxxxxx"
#discovery = "relay"
print_format = "Human"
stream = "both"

rust Debug:

gc@scs:~/neolink $ ./neolink rtsp --config=conf.toml
[2023-04-23T11:02:37Z INFO  neolink] Neolink fb4a23a1f641523dd79bd18630fa89b1e0360fbb release
[2023-04-23T11:02:37Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T11:02:37Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T11:02:37Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2023-04-23T11:02:40Z INFO  neolink_core::bc_protocol] Rear: Relay success xxxxxxxxxxx at 20.108.160.191:51378
[2023-04-23T11:02:53Z ERROR neolink::rtsp] Rear: Fatal error: Rear: Could not login to camera

    Caused by:
        0: IO Error: Custom { kind: Other, error: CameraTerminate }
        1: Camera terminated the connection
Error: Rear: Could not login to camera

Caused by:
    0: IO Error: Custom { kind: Other, error: CameraTerminate }
    1: Camera terminated the connection
gc@scs:~/neolink $ ./neolink rtsp --config=conf.toml
[2023-04-23T09:30:55Z INFO  neolink] Neolink fb4a23a1f641523dd79bd18630fa89b1e0360fbb release
[2023-04-23T09:30:55Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T09:30:55Z DEBUG neolink::rtsp::states::shared] Adding path ["/Rear/Main", "/Rear/MainStream", "/Rear/Mainstream", "/rear/Main", "/rear/MainStream", "/rear/Mainstream", "/Rear/main", "/Rear/mainStream", "/Rear/mainstream", "/rear/main", "/rear/mainStream", "/rear/mainstream", "/Rear", "/rear"] for Rear::Main
[2023-04-23T09:30:55Z WARN  neolink::rtsp::gst::factory] Constructing Factor Impl
[2023-04-23T09:30:55Z DEBUG neolink::rtsp::states::shared] Adding path ["/Rear/Sub", "/Rear/SubStream", "/Rear/Substream", "/rear/Sub", "/rear/SubStream", "/rear/Substream", "/Rear/sub", "/Rear/subStream", "/Rear/substream", "/rear/sub", "/rear/subStream", "/rear/substream"] for Rear::Sub
[2023-04-23T09:30:55Z INFO  neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554
[2023-04-23T09:30:55Z TRACE neolink::utils] Camera Info: BcCameraOpt { name: "Rear", channel_id: 0, addrs: [], uid: Some("9xxxxxxxxxxxX"), port: None, protocol: TcpUdp, discovery: Relay, aux_printing: Human, credentials: {"username": "admin", "password": "******"} }
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol] Rear: Starting Local discovery
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol] Starting Remote discovery
[2023-04-23T09:30:55Z TRACE mio::poll] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
[2023-04-23T09:30:55Z TRACE mio::poll] registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol] Starting Map
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol] Starting Relay
[2023-04-23T09:30:55Z DEBUG neolink_core::bc_protocol::connection::discovery] Broadcasting to: [(255.255.255.255, 2015), (255.255.255.255, 2018), (192.168.0.255, 2015), (192.168.0.255, 2018), (172.17.255.255, 2015), (172.17.255.255, 2018), (172.26.255.255, 2015), (172.26.255.255, 2018), (169.254.255.255, 2015), (169.254.255.255, 2018)]
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol::connection::discovery] Also sending to []
[2023-04-23T09:30:55Z TRACE mio::poll] registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
[2023-04-23T09:30:55Z TRACE mio::poll] registering event source with poller: token=Token(3), interests=READABLE | WRITABLE
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol::connection::discovery] client_id: 124363233
[2023-04-23T09:30:55Z TRACE neolink_core::bc_protocol::connection::discovery] client_id: 1764310492
[2023-04-23T09:30:55Z DEBUG neolink_core::bcudp::xml] Struct: start to parse "P2P"
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(P2P, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG neolink_core::bcudp::xml] Struct: start to parse "M2C_Q_R"
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(M2C_Q_R, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG neolink_core::bcudp::xml] Struct: start to parse "reg"
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(reg, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(ip, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched Characters(20.xxx.xxx.191)
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched EndElement(ip)
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(port, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched Characters(58200)
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched EndElement(port)
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched EndElement(reg)
[2023-04-23T09:30:55Z DEBUG neolink_core::bcudp::xml] Struct: start to parse "relay"
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(relay, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})
[2023-04-23T09:30:55Z DEBUG yaserde::de] Fetched StartElement(ip, {"": "", "xml": "http://www.w3.org/XML/1998/namespace", "xmlns": "http://www.w3.org/2000/xmlns/"})

Versions NVR software: Tried on Zoneminder, Shinobi and vlc Neolink software: Neolink fb4a23a1f641523dd79bd18630fa89b1e0360fbb release Reolink camera model and firmware: Reolink Argus PT v3.0.0.715_21112344

QuantumEntangledAndy commented 1 year ago

Could you try this on the latest version? I noticed that sometimes the camera would drop up with a terminate if we spent too long between discovery completed and waiting for the login. So I changed the discovery hand-off a bit to help with this. Perhaps it can help you here.

buccaneeruk commented 1 year ago

tried latest version and it fires but takes some attempts gc@scs:~/neolink $ ./neolink rtsp --config=conf.toml [2023-04-24T06:42:13Z INFO neolink] Neolink 42ff221b0735bf55fbf9ba2508329ef1fdb540e9 release [2023-04-24T06:42:13Z INFO neolink::rtsp] Starting RTSP Server at 0.0.0.0:8554 [2023-04-24T06:42:15Z INFO neolink_core::bc_protocol] Rear: Relay success 9xxxxxxxxxxxxxX at 20..xxx.xxx.xxx:51450 [2023-04-24T06:42:28Z WARN neolink::rtsp] Rear: Retryable error: Rear: Could not login to camera

Caused by:
    0: IO Error: Custom { kind: Other, error: RelayTerminate }
    1: Relay terminated the connection

[2023-04-24T06:42:31Z INFO neolink_core::bc_protocol] Rear: Relay success 9xxxxxxxxxxxxxX at 20..xxx.xxx.xxx:51450 [2023-04-24T06:42:45Z WARN neolink::rtsp] Rear: Retryable error: Rear: Could not login to camera

Caused by:
    0: IO Error: Custom { kind: Other, error: CameraTerminate }
    1: Camera terminated the connection

[2023-04-24T06:42:48Z INFO neolink_core::bc_protocol] Rear: Relay success 9xxxxxxxxxxxxxX at 20..xxx.xxx.xxx:51450 [2023-04-24T06:43:01Z WARN neolink::rtsp] Rear: Retryable error: Rear: Could not login to camera

Caused by:
    0: IO Error: Custom { kind: Other, error: CameraTerminate }
    1: Camera terminated the connection

[2023-04-24T06:43:04Z INFO neolink_core::bc_protocol] Rear: Relay success 9xxxxxxxxxxxxxX at 20..xxx.xxx.xxx:51450 ==Battery== Charge: 70%, Temperature: 15°C, LowPower: false, Adapter: none, ChargeStatus: none,

[2023-04-24T06:43:18Z INFO neolink::rtsp::states::loggedin] Rear: Camera time is already set: 2023-04-24 7:43:23.0 +00:00:00 [2023-04-24T06:43:19Z INFO neolink::rtsp::states::loggedin] Rear: Camera reports firmware version v3.0.0.715_21112344 [2023-04-24T06:43:19Z INFO neolink::rtsp::states::streaming] Rear: Starting video stream Main Stream (Clear) [2023-04-24T06:43:19Z INFO neolink::rtsp::states::streaming] Rear: Starting video stream Sub Stream (Fluent) ==Battery== Charge: 69%, Temperature: 15°C, LowPower: false, Adapter: none, ChargeStatus: none,

==Battery== Charge: 68%, Temperature: 15°C, LowPower: false, Adapter: none, ChargeStatus: none,

still I get no stream

vlc log on rtsp://admin:pxxxxxxxv@192.168.0.153:8554/Rear
shows

live555 error: Failed to connect with rtsp://192.168.0.153:8554/Rear satip error: Failed to setup RTSP session -- logger module stopped --

QuantumEntangledAndy commented 1 year ago

Ok so it connects after a few times then. After which you just have trouble with VLC. I presume this is to do with the VLC issues I'm tracking in #68. If you could maybe try that build and the seetings shown in the PR

buccaneeruk commented 1 year ago

Sorry was just using vlc as an example it does not actually stream to anything , also tried shinobi, zoneminder and frigate all fail but wiil try your suggestion.. Thank you for your help

buccaneeruk commented 1 year ago

After changes to vlc exact same error,

also noticed that after a period of time neolink loses connectivity to the camera, after the camera terminates the connection and the only way to get back is terminate and restart neolink

QuantumEntangledAndy commented 1 year ago

Is there any reason why I only ever seem to see relay connections with your camera? That usually only happens if your on different networks. It should still work because that's how I test but it does usually mean that we get extra terminate commands.

There's not much I think I can do about the terminates without observing them more myself. They usually only happen with me if the connection is flakey and the camera drops us for having an unstable connection.

buccaneeruk commented 1 year ago

Hi Andy Can confirm my pc , the raspberry pi 4 running neolink and the cameras are all on the same 192.168.0. subnet.

buccaneeruk commented 1 year ago

Hi Andy had a mind blowout and tested neolink on my windows pc and it worked instantly on vlc etc. this means the issue lies with raspianpi os and dietpi os, have tried both and no firewall is setup by default and netstat shows port 8554 is listening RPI is a pi 4 with 4gb ram booting from a 1tb ngff ssd connectivity via rj45. the conf file I use is the same on both windows and RPI . is it possible I am missing a setting somewhere?

QuantumEntangledAndy commented 1 year ago

I really cannot tell since this seems to be a network/firewall type of thing.

Do you know the IP address of your camera? If so have you added it into the addr field of the config? That will allow neolink to use it during discovery which will help with local networks where broadcasts are forbidden.

QuantumEntangledAndy commented 1 year ago

Could be something at the router too. If your rpi is on Ethernet and camera on Wi-Fi maybe there's some sort of network isolation or the bridge dosent forward broadcasts etc.

buccaneeruk commented 1 year ago

I will deep further in to this and keep you updated, it may help someone in the future. And thank you for all your help up to now

buccaneeruk commented 1 year ago

Can now confirm that the issue lies with specific operating systems. Raspberrypi os and dietpi os definitely fail to work, windows and ubuntu server run like a dream Thank you for all the assistance for this awesome product

QuantumEntangledAndy commented 1 year ago

I had a recent user report that windows dosent work and that rpi does so it's likely not as simple as that. Still glad it's working for you.

QuantumEntangledAndy commented 1 year ago

What was your rpi model and OS? I'll see if I can replicate on one of my pis

buccaneeruk commented 1 year ago

Rpi 4 4gb booting on a 1tb ngff ssd

On 26 Apr 2023 09:56, Andrew King @.***> wrote:

What was your rpi model and OS? I'll see if I can replicate on one of my pis

— Reply to this email directly, view it on GitHubhttps://github.com/QuantumEntangledAndy/neolink/issues/73#issuecomment-1523035448, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANDHH7OCHELP7ICTBQR52X3XDDPNHANCNFSM6AAAAAAXIPIWK4. You are receiving this because you modified the open/close state.Message ID: @.***>

QuantumEntangledAndy commented 1 year ago

Thanks. I mostly test on pi3s as my 4 is busy with other things. But I'll see if it makes any difference