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

reolink B400 Timeout #28

Closed
sharee993 opened this issue Jul 6, 2020 · 39 comments
Closed

reolink B400 Timeout #28

sharee993 opened this issue Jul 6, 2020 · 39 comments
Labels
bug Something isn't working

Comments

@sharee993
Copy link

sharee993 commented Jul 6, 2020

Hello, I have been fighting Reolink b400 for a few days but I didn't manage to do anything:

[2020-07-06T14:35:54Z INFO  neolink] Neolink 0.3.0 (unknown commit) release
[2020-07-06T14:35:55Z INFO  neolink] cam: Connecting to camera at 192.168.0.117:9000
[2020-07-06T14:35:55Z INFO  neolink] cam: Connecting to camera at 192.168.0.117:9000
[2020-07-06T14:35:55Z ERROR neolink] Error streaming from camera cam, will retry in 1s: Timeout
[2020-07-06T14:35:55Z INFO  neolink] cam: Connected to camera, starting video stream subStream
[2020-07-06T14:35:56Z INFO  neolink] cam: Connecting to camera at 192.168.0.117:9000
[2020-07-06T14:35:56Z ERROR neolink] Error streaming from camera cam, will retry in 2s: Timeout
@sharee993 sharee993 added the bug Something isn't working label Jul 6, 2020
@thirtythreeforty
Copy link
Owner

Hi - sorry you're having trouble. So the timeout thing looks a lot like #14 - in particular this comment about the system time being set.

Could you try adding the following line to your cam's config section?

timeout = { secs = 5, nanos = 0 }

This will lengthen the timeout. It looks like it is successfully connecting, so perhaps this will solve it.

@thirtythreeforty
Copy link
Owner

Also note that this is a terrible config file syntax; therefore it is not documented officially and it will likely change in the future (but only after this problem is solved).

@sharee993
Copy link
Author

I added but unfortunately nothing helped. camera time is set correctly

@thirtythreeforty
Copy link
Owner

Hmmm. Could you post your config file? (Delete the passwords from it!)

@hh1209
Copy link
Contributor

hh1209 commented Jul 6, 2020 via email

@sharee993
Copy link
Author

sharee993 commented Jul 6, 2020

bind = "0.0.0.0"

[[cameras]]
name = "cam1"
username = "admin"
password = ""
address = "192.168.0.117:9000"
format = " H264"
timeout = { secs = 5, nanos = 0 }

@thirtythreeforty
Copy link
Owner

@kylekartan or @xyphos10: I know you both have B400s. Since support has landed (with format = "H264") have you been able to get your cameras to stream?

@sharee993
Copy link
Author

I tried without h264 but the effect is the same

@thirtythreeforty
Copy link
Owner

You definitely need the H264 line. Also - I don't think this makes a difference but make sure it's

format = "H264"

and not

format = " H264"

(note the leading space).

If that doesn't fix it, could you post a log after setting RUST_LOG=debug? On windows:

set RUST_LOG=debug

On Linux:

export RUST_LOG=debug

@kylekartan
Copy link

kylekartan commented Jul 6, 2020

I may have made a mistake upgrading to the latest available firmware (v2.0.0.16_20041560), this is what I get now with v.30

I also double checked the camera is set to the correct time.

Thanks!

Config:
bind = "0.0.0.0"

[[cameras]]
name = "driveway"
username = "admin"
format = "H264"
timeout = { secs = 5, nanos = 0 }
password = ""
address = "192.168.0.47:9000"

log.txt

@thirtythreeforty
Copy link
Owner

thirtythreeforty commented Jul 6, 2020

Ok. So with two cameras experiencing the same issue, I think it's not either of your faults.

What is needed now is a Wireshark packet capture of the official client talking to the camera. Is anyone comfortable and willing to provide one? Just fire up Wireshark on your computer, hit Record on the network interface you're using, and then open the official client and have it start a stream from the camera. I need to know what it's doing differently than Neolink. A second or two of traffic is totally sufficient; your capture file should be only several megabytes.

If you send me one, send it privately (thirtythreeforty@gmail.com). I will keep it confidential.

@kylekartan
Copy link

No problem, I'll do that this afternoon. Thanks!

@sharee993
Copy link
Author

ok already sent

@jjtimmins
Copy link

Log.txt
I get the same timeout with a D400 using Neolink 0.3.0 even with both new lines in my Config.toml file. Sent packet to your email.
format = "H264"
timeout = { secs = 5, nanos = 0 }

@sharee993
Copy link
Author

Hello, does anyone have any news?

@Michaelflat1

This comment has been minimized.

@hh1209

This comment has been minimized.

@Michaelflat1

This comment has been minimized.

@thirtythreeforty

This comment has been minimized.

@sharee993
Copy link
Author

I found a temporary solution.
I removed timeout = {secs = 5, nanos = 0} from config config enabled neolink. turning off neolink adds timeout = {secs = 5, nanos = 0} to config and turns on neolink in 3-4 time it connects to the camera and works until the next restart.
then again it alone and works proven since yesterday

@thirtythreeforty
Copy link
Owner

@sharee993 I am confused; having trouble understanding what you did. Can you post the config file that works with the D400s?

@sharee993
Copy link
Author

sharee993 commented Jul 9, 2020

  1. turn on neo-linguists without timeout = {secs = 5, nanos = 0} in config
  2. Turn off neolink and add to config timeout = {secs = 5, nanos = 0}
  3. Turn on neolink (it doesn't always work the first time usually 3 together)

in neolink it will show time out but it works

@DanieleQ97
Copy link

DanieleQ97 commented Jul 10, 2020

Hi everyone, I'm having the same issue with a D400.

If it's any help, here is my debug output from neolink:
Schermata del 2020-07-10 19-49-26

Adding or not the timeout line in the config changes nothing.

Also, I'm not having any crash from random threads.

Here is my config file:

bind = "0.0.0.0"

[[cameras]]
name = "TEST"
username = "admin"
#password = "12345678"
address = "192.168.1.123:9000"
#timeout = { secs = 5, nanos = 0 }

Unfortunately, at the moment, I don't have any Reolink NVR lying around so I don't think I can be of any help with Wireshark.

@jjtimmins
Copy link

My Blue Iris compatible RLC-410 5MP streams simultaneously on more than one PC with the Reolink Client app (https://reolink.com/ca/software-and-manual/), but the D400s produce the 'timeout' when trying to open them on a second PC (one D400 with the latest firmware and one not). Closing the client app on the 1st PC releases the D400s, then the D400s streams show up on the second Reolink Client app PC. Seems that D400s could only stream to one ip at a time. Even with all closed streams, I still get the timeout error with Neolink, though it shows connected momentarily (see debug log below). The log show that the timeouts happen after attempting to open the same camera stream twice in a row. Could this second consecutive connection attempt cause this timeout in the same way that we get when trying to stream on a second Reolink Client PC?
image

@thirtythreeforty
Copy link
Owner

Hm, that's a great point @jjtimmins. Can you add

stream = "mainStream"

to that camera's configuration and retry? Currently it attempts to stream both the main and substream (HD/SD basically). If it's true you can only connect one stream at a time, what could be happening is that the subStream connects first, blocking the bigger stream from ever starting.

@DanieleQ97
Copy link

DanieleQ97 commented Jul 12, 2020

It works, that was the problem.

Apparently D400 cameras (and probably B400) only allow one stream at time.

Edit: That also probably means we don't need the timeout line anymore.
At least, to me, it works without it.

@thirtythreeforty
Copy link
Owner

thirtythreeforty commented Jul 12, 2020

Ha! Great.

Ok. So now we need to teach Neolink about all these nuances. I think that detecting the type of camera will be a prerequisite (#36). Then, clearly announce which streams it's launching (#35).

Bonus points: loudly complain when someone tries to connect to a stream that isn't supported.

@kylekartan
Copy link

kylekartan commented Jul 12, 2020

Sweet! Adding the stream = "mainStream" worked for me as well. I had some trouble with it erroring so I increased the timeout value to 8 seconds and now it's working so far.

Update: I was able to successfully add the stream to Milestone XProtect so everything is working!

@jjtimmins
Copy link

Way to go thirtythreeforty, that worked!! BTW, timeout not needed. Strange that D400's can only deliver one stream because the Reolink Client app shows two streams are available. Not sure how they make the record work with their brand NVRs for continuous recordings on substream and motion detect recording on mainstream. Would be nice to have BlueIris access both streams.
image

@DanieleQ97
Copy link

DanieleQ97 commented Jul 12, 2020

@jjtimmins Maybe they just continuosly switch from one stream to the other instead of connecting to both of them at the same time.
Probably something similar can also be done in Neolink, maybe telling it to switch from one stream to the other with some RTSP request.

Something like:

  1. Client send PLAY rtsp://127.0.0.1:8554/your_camera_name/subStream RTSP/1.0
  2. Neolink connect to your_camera_name substream.
  3. Client send PLAY rtsp://127.0.0.1:8554/your_camera_name/mainStream RTSP/1.0
  4. Neolink close connection to your_camera_name substream and open mainstream.
  5. Etc.

That way you can setup a script with something like Motion that by default request Neolink the substream but ask him to switch to the mainstram if some movement is detected.

Maybe Neolink can have this beaviour if it detects (#36) a "series 400" camera and instead connect to both streams at startup if a "series 800" is detected.

@jjtimmins
Copy link

My BlueIris is not connecting the D400 with the settings at the bottom of #11. When I click Okay, the camera initiates the connection and I get this error. Are D400 BlueIris video configs different?
image

@hh1209
Copy link
Contributor

hh1209 commented Jul 13, 2020

Do you get that error before or after you try to connect in BI?

@DanieleQ97
Copy link

DanieleQ97 commented Jul 13, 2020

@jjtimmins If you are talking about this:

BISetup

You should probably leave empty the subStream path (or set it the same as mainstream) since you have already disabled it in Neolink adding stream = "mainStream" in its config file.

That said, I don't think that is requesting the disabled stream that's crashing Neolink.
You should run set RUST_BACKTRACE=1 as suggested and maybe also set RUST_LOG=debug before running Neolink again so that we can see more clearly what's happening.

@jjtimmins
Copy link

jjtimmins commented Jul 14, 2020

The error only occurs immediately after I click OK after configuring the camera, or if I rightclick the camera window and 'Restart camera', showing the colored bars in the BI screen then a no signal message, but never any stream. I have left out the substream statement as you noted. Rust backtrace produce the attached log. Backtrace_Full provides more detail, though with just one camera 'Entrance' in config.toml. My Gstreamer installation was not pretty, with 'Typical' leaving missing dlls and a reinstallation of the whole 1.16.2 version to resolve. Strange that this config, Blue Iris and Gstreamer install on another PC (my laptop) actually streams with exact copied settings. Only difference is wonky GStreamer installation in this case.
Rust_Backtrace.txt
Rust_Backtrace full.txt

@jjtimmins
Copy link

Finally resolved by trouble shooting defective GStreamer installation using (1.16.2 runtime installer) at https://gstreamer.freedesktop.org/download/. Uninstalled it, deleted C:\GStreamer directory, rebooted PC, reinstalled full GStreamer 1.16.2, rebooted, ran Neolink in CMD, still several missing DLLs when running Neolink!?? Copied full C:\Gstreamer folder from laptop where it works (not sure how I got GSteamer to install properly there) to this new NAS build, and now it works, all streams for my three D400s!? Anyone else having issues installing Gstreamer on Win 10 pro? (Build 19041)

@That-Dude
Copy link

I finally got both of my D400 cameras working with BlueIris - thanks so much George.

I'm copying my settings here in case someone finds them useful.

Install G-Streamer using Choco

choco install gstreamer

I grabbed the neolink Windows build from here

Make a folder c:\neolink and copy in the neolink executable

Create "config.toml" in the same folder:

bind = "0.0.0.0"

[[cameras]]
name = "cam1"
username = "admin"
password = "yourpassword"
address = "192.168.124.230:9000"
stream = "mainStream"
format = "H264"
timeout = { secs = 5, nanos = 0 }

bind = "0.0.0.0"

[[cameras]]
name = "cam2"
username = "admin"
password = "youpassword"
address = "192.168.124.231:9000"
stream = "mainStream"
format = "H264"
timeout = { secs = 5, nanos = 0 }

Setup cameras in BlueIris

Screenshot 2020-07-17 at 16 23 43

@thirtythreeforty
Copy link
Owner

Hey all - thanks for troubleshooting this. It's good to know it can handle only one stream at a time. When Neolink autodetects camera type, it'll autoconfigure that quirk as well.

Closing this but feel free to ask questions if you have them.

@QuantumEntangledAndy
Copy link
Collaborator

QuantumEntangledAndy commented Sep 25, 2020

So I was looking for our protocol and wanted to ask a question about this one stream issue.

Currently we do this:

  • Start camera_loop with main arg on own thread
    • connect to camera
    • subscribe to main
    • loop main message and send to rtsp
  • Start camera_loop with sub arg on own thread
    • connect to camera
    • subscribe to sub
    • loop sub message and send to rtsp

Could we instead do

  • Start camera_loop on own thread
    • connect to camera
    • subscribe to main
    • subscribe to sub
    • loop main and sub message and send to rtsp

@QuantumEntangledAndy
Copy link
Collaborator

I also notice that on the official client when accessing the substream the handle is 256 but we always use 0. Perhaps we should adjust this and see if it helps with multi access

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

9 participants