Giter Club home page Giter Club logo

neolink's Introduction

Development has moved

Neolink is now maintained at https://github.com/QuantumEntangledAndy/neolink as I no longer have time to dedicate to development. Please direct your thanks and bug reports over there!

Neolink

CI

Neolink is a small program that acts as a proxy between Reolink IP cameras and normal RTSP clients. Certain cameras, such as the Reolink B800, do not implement ONVIF or RTSP, but instead use a proprietary "Baichuan" protocol only compatible with their apps and NVRs (any camera that uses "port 9000" will likely be using this protocol). Neolink allows you to use NVR software such as Shinobi or Blue Iris to receive video from these cameras instead. The Reolink NVR is not required, and the cameras are unmodified. Your NVR software connects to Neolink, which forwards the video stream from the camera.

The Neolink project is not affiliated with Reolink in any way; everything it does has been reverse engineered.

Supported cameras

Neolink intends to support all Reolink cameras that do not provide native RTSP. Currently it has been tested on the following cameras:

  • B800/D800
  • B400/D400
  • E1
  • Lumus
  • 510A

Neolink does not support other cameras such as the RLC-420, since they already provide native RTSP.

Usage

  1. First, write a configuration yaml file describing your cameras. See the Configuration section below or the provided sample config.

  2. Launch Neolink:

neolink rtsp --config=your_config.yaml
  1. Then, connect your RTSP viewer to rtsp://127.0.0.1:8554/your_camera_name!

Additional commands

Neolink also has some additional command line tools for controlling the camera. They are all used through neolink subcommands like this:

neolink subcommand --config=...

The currently supported subcommands are

  • rtsp: The standard neolink rtsp bridge
  • status-light: Control the LED status light
  • reboot: Reboot a camera
  • talk: Enable talk back through either the microphone or by reading a sound file.

For a full list of commands use neolink help, or use neolink help <subcommand> for details on a subcommand of interest.

Download & Installation

Builds are provided for the following platforms:

Windows/Linux

  1. Install Gstreamer from the most recent MSI installer on Windows, or your package manager on Linux.

    On Ubuntu/Debian machines gstreamer can be installed with:

    sudo apt install \
      libgstrtspserver-1.0-0 \
      libgstreamer1.0-0 \
      libgstreamer-plugins-bad1.0-0 \
      gstreamer1.0-plugins-good \
      gstreamer1.0-plugins-bad
  2. If you are using Windows, add the following to your PATH environment variable:

    %GSTREAMER_1_0_ROOT_X86_64%\bin
    

    Note: If you use Chocolatey to install Gstreamer, it does this automatically.

  3. Download and unpack Neolink from the links above.

    1. Note: you can also click on this link to see all historical builds. You will need to be logged in to GitHub to download directly from the builds page (wget doesn't work)

    Ubuntu/Debian/Raspberry Pi OS example:

    unzip release-arm64-buster.zip
    sudo cp neolink /usr/local/bin/
    sudo chmod +x /usr/local/bin/neolink
  4. Write a configuration file for your cameras. See the section below.

  5. Launch Neolink from a shell, passing your configuration file:

    neolink rtsp --config my_config.toml
  6. Connect your NVR software to Neolink's RTSP server.

    The default URL is rtsp://127.0.0.1:8554/your_camera_name if you're running it on the same computer. If you run it on a different server, you may need to open firewall ports. See the "Viewing" section below for more troubleshooting.

Docker

A Docker image is also available containing Neolink and all its dependencies. The image is thirtythreeforty/neolink. Port 8554 is exposed, which is the default listen port. You must mount a configuration file (see below) into the container at /etc/neolink.toml.

Here is a sample launch commmand:

docker run \
  -p 8554:8554 \
  --restart=on-failure \
  --volume=$PWD/config.toml:/etc/neolink.toml \
  thirtythreeforty/neolink

Here is an example docker-compose:

---
version: "2"
services:
  neolink:
    image: thirtythreeforty/neolink
    container_name: neolink
    ports:
      - 8554:8554
    volumes:
      - $PWD/neolink.toml:/etc/neolink.toml
    restart: unless-stopped

The Docker image is "best effort" and intended for advanced users; questions about running Docker are outside the scope of Neolink.

If you use a battery-powered camera (or other UDP-only camera) you will need to either use --net=host or setup a macvlan for the docker image that supports UDP broadcast. This is because UDP requires that udp broadcast messages are transmitted across the docker network interface, however this is not possible in the default bridging mode

Configuration

Note: for a more comprehensive setup tutorial, refer to the Blue Iris setup walkthrough in docs/ (which is probably also helpful even with other NVR software).

Note: more comprehensive setup details for linux based devices is provided in docs/unix_setup.md

Note: instructions for also setting up a (systemd based) service for linux based devices is provided in docs/unix_service.md

Copy and modify the sample_config.toml to specify the address, username, and password for each camera (if there is no password, you can omit that line). The default credentials for some cameras is username admin password 123456.

  • For a non battery powered camera you need to provide the address field with the ip and port (default 9000).

  • For a battery powered camera you need to provide the uid field with the camera's UID. In this case your network must support UDP. Battery cameras exclusively use this UDP mode so you must always use a UID.

Each [[cameras]] block creates a new camera; the name determines the RTSP path you should connect your client to.

By default, the HD stream is available at the RTSP path /name or /name/mainStream, and the SD stream is available at /name/subStream. You can use only the HD stream by adding stream = "mainStream" to the [[cameras]] config, or only the SD stream with stream = "subStream".

Note: The B400/D400 models only support a single stream at a time, so you must add this line to sections for those cameras.

By default Neolink serves on all IP addresses on port 8554. You can modify this by changing the bind and the bind_port parameter. You only need one bind/bind_port setting at the top of the config file.

You can enable rtsps (TLS) by adding a certificate = "/path/to/pem" to the top section of the config file. This PEM should contain the certificate and the key used for the server. If TLS is enabled all connections must use rtsps. You can also use client side TLS with the config option tls_client_auth = "none|request|require"; in this case the client should present a certificate signed by the server's CA.

TLS is disabled by default.

You can password-protect the Neolink server by adding [[users]] sections to the configuration file, but this is not secure without also using TLS:

[[users]]
name: someone
pass: somepass

you also need to add the allowed users into each camera by adding the following to [[cameras]].

permitted_users = ["someone", "someoneelse"]

Anywhere a username is accepted it can take any username or one of the following special values.

  • anyone means any user with a valid user/pass
  • anonymous means no user/pass required

The default permitted_users list is:

  • [ "anonymous"] if no [[users]] were given in the config meaning no authentication required to connect.

  • [ "anyone" ] if [[users]] were provided meaning any authourised users can connect.

You can change the Neolink log level by setting the RUST_LOG environment variable (not in the configuration file) to one of error, warn, info, debug, or trace:

  • On sh:
set RUST_LOG=debug
  • On Bash:
export RUST_LOG=debug

Viewing

Connect your RTSP client to the stream with the name you provided in the configuration file.

Again, the default URL is rtsp://127.0.0.1:8554/your_camera_name if you're running it on the same computer as the client. The smaller SD video is rtsp://127.0.0.1:8554/your_camera_name/subStream.

4K cameras send large video "key frames" once every few seconds and the client must have a receive buffer large enough to store the entire frame. If your client's buffer size is configurable (like Blue Iris), ensure it's set to 20MB, which should ensure plenty of headroom.

Stability

Neolink has had minimal testing, but it seems to be very reliable in multiple users' testing.

The formats of all configuration files and APIs is subject to change as required while it is pre-1.0.

Development

Neolink is written in Rust, and binds to Gstreamer to provide RTSP server functionality.

To compile, ensure you have the Rust compiler, Gstreamer, and gst-rtsp-server installed.

Then simply run:

cargo build

from this top directory.

Baichuan Protocol

The "port 9000" protocol used by Reolink and some Swann cameras is internally referred to as the Baichuan protocol; this is the company based in China that is known internationally as Reolink.

This protocol is a slightly convoluted header-data format, and appears to have been upgraded several times.

The modern variant uses obfuscated XML commands and sends ordinary H.265 or H.264 video streams encapsulated in a custom header.

More details of the on-the-wire protocol are provided in dissector/.

Baichuan dissector

A Wireshark dissector is available for the BC wire protocol in the dissector directory.

It dissects the BC header and also allows viewing the deobfuscated XML in command messages. (It cannot deobfuscate newer messages that use AES encryption.) To use it, copy or symlink it into your Wireshark plugin directory; typically this is ~/.local/lib/wireshark/plugins/ under Linux.

Currently the dissector does not attempt to decode the Baichuan "extension" messages except binaryData. This will change in the future as reverse engineering needs require.

License

Neolink is free software, released under the GNU Affero General Public License v3.

This means that if you incorporate it into a piece of software available over the network, you must offer that software's source code to your users.

neolink's People

Contributors

cincodenada avatar dependabot[bot] avatar hh1209 avatar jbremond avatar kevans91 avatar kevin-david avatar kickbits avatar m1k1o avatar morphy99 avatar mpfl avatar quantumentangledandy avatar sebix avatar thirtythreeforty avatar twistedddx avatar zhulik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neolink's Issues

neolink connecting to camera but no RTSP output

neolink .20
gstreamer-1.0-msvc-x86_64-1.16.2
Windows 10 x64
Reolink B400 v2.0.0.448_19061400

Greetings!
tl;dr version: neolink starts successfully and connects to camera but does not produce any available RTSP output.

I haven't been able to figure out how to save the debug output to a file, but once it starts it repeats every 30 seconds:
[date/time: DEBUG neolink::gst] RTSP: Media Configured

(the 30 second delay seems to be the NVR attempting to connect)

I've tried viewing the RTSP stream with VLC, Blue Iris, Milestone, no success. Usually the client tries to connect and says "cannot connect" "no stream available" etc.

Let me know if you need further information.

More detailed installation instructions

Trying to get Neolink up and running on a windows 10 computer so I can stream from my B800s right into Blue Iris. I am not a developer and I am lost trying to add paths after installing Gstreamer. Could we get a few more details on install instructions?

Improve logging for main/substream

Currently Neolink just prints "connecting" or "error." It would be great to know exactly which streams it's connecting to.

Redesign the console output so it's more clear what's going on.

Memory allocation failure

Rarely, Neolink prints the following error, "Memory allocation of xxxxx bytes failed." Then the process stops.

This has only happened to me three times. All three times it seems that Neolink was retrying to connect to cameras a lot.

Screenshot_20200524-163404_Microsoft_Remote_Desktop

Screenshot_20200601-113820_Microsoft_Remote_Desktop

Memory Leak 2

Substream proxying ?

Is it possible to pull the substream from camera into neolink rather than just the 4k stream ?

Reason behind this is for a few reasons.

  1. I record 24x7, I'd like to optimise the storage by recording a 24x7 low/medium stream, and then on motion detection, switch to recording the HD stream.

  2. Processing 4k video streams for real time object detection is painful

Nice to have: Some method of setting the substream output size stream would be useful, unsure if gstreamer can do this natively, or would require ffmpeg

Unable to view stream using vlc - "Failed to connect", "Failed to setup RTSP session"

Neolink itself seems to be working but I"m unable to view the stream using VLC as a client. This is with a Reolink E1 camera. I can connect to the camera with the reolink app.

Neolink seems to work:

./neolink --config my_config.toml
[2020-07-18T19:53:23Z INFO  neolink] Neolink 0.3.0 (unknown commit) release
[2020-07-18T19:53:23Z INFO  neolink] one: Connecting to camera at 10.0.0.21:9000
[2020-07-18T19:53:23Z INFO  neolink] one: Connecting to camera at 10.0.0.21:9000
[2020-07-18T19:53:23Z INFO  neolink] one: Connected to camera, starting video stream mainStream
[2020-07-18T19:53:23Z INFO  neolink] one: Connected to camera, starting video stream subStream

My config:

bind = "0.0.0.0"

[[cameras]]
name = "one"
username = "admin"
password = "MY PASSWORD"
address = "10.0.0.21:9000"

My vlc command line:
vlc rtsp://127.0.0.1:8554/one
My vlc log:

live555 error: Failed to connect with rtsp://127.0.0.1:8554/one
satip error: Failed to setup RTSP session

Do I need more vlc command line flags?

Use camera's motion detection

Some camera's come with motion detection. I would like to have some way for neolink to signal that motion was detected.

For now I think just printing to std-out but ultimately I am thinking of some sort of control interface (maybe a rest API) would be good. I envisage we can add command and control to this control interface, PTZ turning the camera on and off etc etc.

Here are the relevent wireshark packets for motion detection

motion.pcapng.zip

It is just a BC packet of the msg-id 33:

  • Motion start
<?xml version="1.0" encoding="UTF-8" ?>
<body>
<AlarmEventList version="1.1">
<AlarmEvent version="1.1">
<channelId>0</channelId>
<status>MD</status>
<recording>0</recording>
<timeStamp>0</timeStamp>
</AlarmEvent>
</AlarmEventList>
</body>
  • Motion stop
<?xml version="1.0" encoding="UTF-8" ?>
<body>
<AlarmEventList version="1.1">
<AlarmEvent version="1.1">
<channelId>0</channelId>
<status>none</status>
<recording>0</recording>
<timeStamp>0</timeStamp>
</AlarmEvent>
</AlarmEventList>
</body>

Stream client "No Signal" when left for long periods of time

The streams start and work well. However, when left to record for long periods of time (30+ minutes - overnight), eventually cameras start dropping out of my streaming application, and I will get "no signal" errors. This will happen one camera at a time, while the other cameras stream just fine. It will go all the way down to one camera, then drop that one as well (edit: dropping the last camera is unverified).

BlueIris Screenshot

When I look at the command prompt that neolink is running in, I don't get connection error messages as I would expect. Instead, I get "GLib-Warning" messages.

GLib Warning

I have tried this on two machines and was able to produce the same result.

Question: "command not found" in terminal

Describe the bug
Thanks for the effort, but i get neolink: command not found when running neolink --config my_config.toml in the Terminal on a Intel NUC on Ubuntu 20.04. My goal would be to integrate neolink into Homeassistant as well like @QuantumEntangledAndy did. What am I doing wrong? To be honest, i'm not a linux pro, so i'm sure the the bug is not in neolink but in my skills.

To Reproduce
Steps to reproduce the behavior. Example:

  1. Open Terminal in a folder which has neolink, neolink.d and my_config.toml in it
  2. Type neolink --config my_config.toml
  3. Press Enter

Expected behavior
neolink starts

Versions
Neolink software: Most recent
Reolink camera model and firmware: E1

Question: Error: IoError(Os { code: 21, kind: Other, message: "No such file or directory" }) in Docker

Describe the bug
If anyone can assist with this I would greatly appreciate it. I am very green when it comes to Docker and Containers, but am trying to learn. I just cannot find any help with this anywhere. When using the following CMD to load the image to a container using Portainer and Container Station on QNAP (even directly via SSH):

docker run --rm -p 9554:8554 -v /neolink.conf:/etc/neolink.conf mr2jzgte/neolink
or
docker run --rm -p 9554:8554 -v /neolink.conf:/etc/neolink.conf thirtythreeforty/neolink
or
docker run
-p 8554:8554
--restart=on-failure
--volume=$PWD/config.toml:/etc/neolink.toml
thirtythreeforty/neolink

I receive the following errors:
Error: IoError(Os { code: 21, kind: Other, message: "Is a directory" })
or
Error: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })

To Reproduce

  1. I have tried using the GUI in Container Station with with loaded thirtythreeforty/neolink:latest docker image (loads ENV and CMD info into Container Station) as well as mr2jzgte/neolink and the containers build, but then powers off immediately and in the log I get the error listed above.
  2. I tried loading both images into a container via Portainer with the same results.
  3. I also SSH'd into the QNAP and ran the commands manually resulting in the same error.

Expected behavior
For the Docker image to load into the container and run properly without any errors.

Versions
Neolink software: latest
Reolink camera model and firmware: D800 with latest firmware

Improve compatibility with third party video players

Describe the bug
Currently many video players cannot play video coming out of the RTSP server (see trouble users are having in #19 for example). This is probably because their receive buffers are too small for a 4K keyframe, or else the OS is dropping UDP packets because each keyframe is a lot of traffic all at once.

To Reproduce
Open Neolink's RTSP stream from any Reolink camera in VLC. No video. In other players, at best it's garbled.

Expected behavior
The video should play, without any monkeying with receive buffers, protocols, or other technical details.

Ideas: "smooth out" the incoming key frames that cause so many problems by rate-limiting them just a little bit.

Protocol documentation/question.

So I came across your blog post which linked me here when googling about the protocol used,
and I must say, good work! The reason I was interested in the protocol used is I was going to
look into creating a replacement for the vendor's Reolink Client application, to be a more or less
1:1 replacment as far as existing functionality goes and overcoming some of its limitations (no
more than 36 displays at once, for example) and providing a native linux client.

However, I don't grok rust at all. Do you have some kind of language-agnostic description of
the baichuan protocol?

Handle errors during video streaming

Currently the camera_main thread will just quit if any send/receive errors occur. While giving up might be correct for some errors, typically we should back off and retry.

D800 Works fine for few hours, then authentication errors later

Describe the bug
Seems to work fine, at least it did from 5pm to 11pm

To Reproduce
Occurs randomly?
Expected behavior
It should continue to work
Versions
Latest Reolink firmware on D800. 4K 20fps 4mb/s main stream and 360p 15fps 512kb/s fluent stream.
(gateHQ is substream only of the camera... gateHD is the mainstream.. i seperated like this as i already setup a monitoring display to look at gateHQ.. and didn't want to change RTSP address)

At the end is a pastebin of a long log

I think main error is this:
thread 'main' panicked at 'assertion failed: (left != right)

https://pastebin.com/5fj380ys

Thanks in advance :)
Running on raspbian raspberry pi, I used cargo to compile it instead of downloading a prebuilt binary. Seems to be the latest version of neolink.

a sudo reboot does not fix this. But I can still login to the camera using the reolink client software, and this seems to fix the issue. Perhaps it is similar to D400 issue where the camera loses time.

Use correct timestamps

Is your feature request related to a problem? Please describe.
Currently we use the clock for the time stamps. This is not ideal, it would be get the timestamp from the header of media packets (bytes 16-20 of the I and P frames).

Describe the solution you'd like
Use the set_dts and set_pts in the gstreamer::Buffer object (described here) to set the time stamps.

Support for Argus Pro

Thanks for the great piece of software as well as the interesting article on your blog!
I have a Reolink Argus Pro which unfortunately is not yet compatible with Neolink:

[2020-07-06T20:17:59Z INFO  neolink] Neolink 0.3.0 (unknown commit) release
[2020-07-06T20:17:59Z INFO  neolink] Terrasse: Connecting to camera at 192.168.50.194:9000
[2020-07-06T20:17:59Z INFO  neolink] Terrasse: Connecting to camera at 192.168.50.194:9000
[2020-07-06T20:18:00Z ERROR neolink] Error streaming from camera Terrasse, will retry in 1s: Connection error
[2020-07-06T20:18:00Z ERROR neolink] Error streaming from camera Terrasse, will retry in 1s: Connection error

NMap tells me port 9000 TCP is closed, so this is not surprising.

I am new to Wireshark, Lua and reverse engineering things, so please forgive me my lack of knowledge. I tried to capture the communication between Reolink's macOS client and the camera, and everything is done over UDP, so no TCP at all. However, I think the protocol works similar to what you described: In the packet capture I can see the magic bytes you described, legacy authentication using md5 hashes missing the last character, and later packets are potentially XML-based, as I see the same bytes in the data reoccurring.

I would be very happy if you would try to support the Argus Pro and please let me know if I can be of assistance.
Please find attached a short packet dump of connecting to the camera (user/pw = admin/123456), getting a few frames of video streams, and disconnecting.

Argus Pro dump.pcapng.zip

Queue needed in gst

Describe the bug
Gst reports that there is not enough buffers when connecting long distance over UDP (ssh tunnel on the bus over 4G fyi)

To Reproduce
Steps to reproduce the behavior. Example:

  1. Set GST_DEBUG to 3
  2. Launch neolink over a latent connection
  3. Connect to neolink over UDP, (TCP seems fine)

Expected behavior
Gst debug logs not to report a warning like this

WARN                basesink gstbasesink.c:1218:gboolean gst_base_sink_query_latency(GstBaseSink *, gboolean *, gboolean *, GstClockTime *, GstClockTime *):<multiudpsink0> warning: Not enough buffering available for  the processing deadline of 0:00:00.020000000, add enough queues to buffer  0:00:00.020000000 additional data. Shortening processing latency to 0:00:00.000000000.

We should probably just add a queue to the gst launch command. I will work up a PR when I get time and this is to keep track of the issue until then

Quick Test Steps

I successfully built the server in Gentoo and have it running and connect to a single camera.
I'm gated at what to use to connect to the neolink server to verify.

I tried VLC on the same machine as the server is running, a laptop, and then in VLC: Media->Open Network Stream [Cntrl-N] and entered:

rtsp://localhost:8554

I have been out of touch with streaming videos for over a year, it would be helpful to have instructions on how to easily test with VLC whether a stream is working. And if you have multiple cameras as the example configuration file has, one probably has to specify it in the URL to VLC?

Can you provide some instructions for a quick assay?

Realize people might come to this project out of the video streaming arena and test it, so what may seem second nature to you may be a stumbling block -- my problem is a case in point. Once I've verified this is working, then I'll dive deeper into the protocols, so helping someone out of the blue try this out so they can actually see the results goes a long way. Also, I was interested in Shinobi, until I studied his licensing and walked away from it. And Blue Iris is proprietary. So that leaves VLC for testing single streams, yes?

Support RTSP security

Allow configuring a username/password for the served RTSP stream. Also allow specifying a TLS certificate.

Have created a docker image for app

Pretty Basic based off the ubuntu base image (rather than source - optimised version will be coming soon built from source and latest code)

docker run --rm -p 9554:8554 -v /neolink.conf:/etc/neolink.conf mr2jzgte/neolink

exposed on port 9554, modify as required.

if needed, troubleshoot via

docker run --rm -it -p 9554:8554 --entrypoint bash -v /neolink.conf:/etc/neolink.conf mr2jzgte/neolink

Have a builtin watchdog, that if the process isn't running, it will restart it. (may need tweaking)
My first docker image build - so it's a learning curve

Unable to stream from B400

Hello, first of all good work on this project and I am just reaching out because I am unable to get this to work with our B400 cameras. I have attached the debug log file from neolink.

Also, I noticed that if I upgrade the firmware on the B400 to build 20041560 (latest by reolink) the stream fails to start between neolink and the camera. I have also attached this log file.

Camera Firmware: B400 build 18092103 IPC_5128M
VLC: v3.0.11
FFplay: ffplay version git-2020-06-20-29ea4e1
OS: Linux web 5.3.0-59-generic #53~18.04.1-Ubuntu
Neolink: version 0.2.0 Commit 9a0eb56

stream.log

B400-build20041560.log

Provide ARMv6 and ARMv7 Linux builds

Many people want to use Neolink on a Raspberry Pi. This is perfectly feasible. However, it would take a long time to compile. Instead, provide a cross-compiled prebuilt for ARM.

New firmware breaks Neolink - B800

Describe the bug
Was working perfectly before. After I updated to the new firmware the below is shown:
https://ibb.co/7R0bVVj

Repeatedly says:
[2020-07-24T03:01:47Z INFO neolink] driveway: Connecting to camera at 192.168.0.52:9000
[2020-07-24T03:01:47Z INFO neolink] driveway: Connected to camera, starting video stream mainStream
[2020-07-24T03:01:48Z ERROR neolink] Error streaming from camera driveway, will retry in 1s: Timeout
[2020-07-24T03:01:49Z INFO neolink] driveway: Connecting to camera at 192.168.0.52:9000

Firmware is: IPC_5158MP8M.17_20042200.B800.IMX317.8MP.REOLINK.pak

Viewing the camera through the Reolink client works fine.

RTSP TCP support

Switching to TCP (e.g. vlc --rtsp-tcp) causes segmentation fault.

image

Using only UDP causes packet loss and damaged frames. Even when my B800 camera is directly connected to Ethernet port of my PC. I often see such Image. Since my picture is in 4K, it causes huge traffic. Maybe other models with HD stream only are working good.

image

I was able to mitigate flickering by adjusting some parameters in VLC:

vlc --network-caching=800 --no-sout-audio --rtsp-frame-buffer-size=800000 --no-skip-frames --no-drop-late-frames --udp-timeout 15

But it's not definitley gone. At night, when image switches to only grayscale, everything works good, so it must be bandwdth problem. I guess, TCP would solve this problem, or am I something missig, how could I solve this problem?

Blue Iris - Error: 8000274d

Is your feature request related to a problem? Please describe.
I followed the readme in regards to BlueIris and cannot get the camera I am testing to display. I get "Camera: No Signal"
Error: 8000274d

Describe the solution you'd like
I just need to know if I did everything correctly? I followed all the instructions, but can't seem to connect to the camera in BlueIris.

2020-08-26_11-45-50
2020-08-26_11-47-16
2020-08-26_11-48-15
2020-08-26_11-49-38

Any help would be greatly appreciated!

Only run Docker build if credentials are configured

Is your feature request related to a problem? Please describe.
@QuantumEntangledAndy noticed that his fork was constantly failing the Docker CI job. This is because he does not have Docker credentials configured on his fork.

Describe the solution you'd like
Only run the Docker build, or push, if push credentials are configured.

Stream audio in same RTSP feed

The cameras optionally support audio - this is disabled by default. However it should be possible to mux this into the same RTSP feed. More reverse engineering is needed to learn the Baichuan format for audio.

SMD SOIC8 socket

From your article, you stated:
I was wanting to try out a really neat little SOIC socket I had discovered and ordered on Taobao a little while back.

Can you provide a link to that socket? I've been meaning to install exactly such a socket in a very troublesome laptop with a Winbond SOIC8 BIOS flash chip that loves to corrupt itself every couple years, requiring an extraction and reflash to get working again. I fear the next removal/reinstall cycle might lift some traces.

Invalid NAL units reported by ffmpeg

Describe the bug
When using neolink with ffmpeg, ffmepg reports that it is recieving invalid NAL (h264) units.

To Reproduce
Start neolink with h264 stream and open with ffplay

Log will include items such as

[h264 @ 0x7f9866877c00] Invalid NAL unit 0, skipping.    0B f=0/0
[h264 @ 0x7f9866877c00] Invalid NAL unit 0, skipping.    0B f=0/0
[h264 @ 0x7f9866877c00] Invalid NAL unit 0, skipping.    0B f=0/0
[h264 @ 0x7f9866877c00] Invalid NAL unit 0, skipping.    0B f=0/0
[h264 @ 0x7f9866877c00] Invalid NAL unit 8, skipping.    0B f=0/0

Expected behavior
ffmpeg/ffplay to report a valid stream

Versions
Neolink version: head (95935d331b3c8b2de07a8d40ec7b9580a16424c7e)
Reolink camera model and firmware: E1

I think this is to do with the extra data that neolink sends along with the video such as the aac. Filtering this out may be sufficient.

Connection failure to Argus Eco

Neolink throws an "Error streaming from camera" when attempting to connect to the camera.

Reolink camera model and firmware: Argus Eco, build 19120201, firmware 1202_491_352_19

Config.toml:

bind = "0.0.0.0"
# bind_port = 8554

[[cameras]]
name = "GateCam"
username = "admin"
password = "password"
address = "192.168.77.12:9000"
format = "h264"

I've tried with/without h264.

Output:
$ ./neolink --config config.toml
[2020-07-31T11:45:41Z INFO neolink] Neolink 0.3.0 (unknown commit) release
[2020-07-31T11:45:41Z DEBUG neolink::gst] Permitting anonymous to access /GateCam, /GateCam/mainStream
[2020-07-31T11:45:41Z DEBUG neolink::gst] Permitting anonymous to access /GateCam/subStream
[2020-07-31T11:45:41Z INFO neolink] GateCam: Connecting to camera at 192.168.77.12:9000
[2020-07-31T11:45:41Z INFO neolink] GateCam: Connecting to camera at 192.168.77.12:9000
[2020-07-31T11:45:42Z ERROR neolink] Error streaming from camera GateCam, will retry in 1s: Connection error
[2020-07-31T11:45:42Z ERROR neolink] Error streaming from camera GateCam, will retry in 1s: Connection error

etc.

Segmentation fault when running in Docker

Using the hosted docker image, B800 camera, and no other clients connecting to the camera

I'm able to test in BI, and connect to the subStream without issue (i do get random Segmentation Faults, but they do not seem to effect the stream). But when i attempt to access the mainStream, i get repeated Segmentation Faults every few seconds. an the stream will not load.

#https://github.com/thirtythreeforty/neolink
bind = "0.0.0.0"

[[cameras]]
name = "HD1"
username = "admin"
password = ""
address = "192.168.11.207:9000"
stream = "both"
format = "H264"
timeout = { secs = 5, nanos = 0 }
~
~
~
~
~
~
~
~
~
~
~
~
~
neolink.toml 1,4 All

[2020-07-23T01:03:51Z INFO neolink] HD1: Connected to camera, starting video stream mainStream,
Segmentation fault (core dumped),

main- and sub-stream streaming prevents use of other clients

@hh1209 noticed that the substream consumes another connection to the camera:

Are you streaming simultaneously from another device (i.e. an NVR, the mobile app, the PC app)? I noticed that once the substreams were added, I was no longer able to stream the HD feed in two places at once.

Experimentally, the cameras can only have two connections active at once. Is it possible to stream both streams on one connection? If so, are the connections the limit, or are the hardware encoders? If the encoders are the limit, it does not matter how many TCP connections there are.

Loss of connection from all cameras when one is disconnected

When streaming multiple cameras on Neolink, all streams stop working when one camera is disconnected. When the camera is disconnected, it takes a few seconds (10 or more) for the frame rate on the other cameras to drop to zero.

When the same camera is reconnected, all camera streams come back online.

Support for H.264 video (E1, D400, etc)

I have the Reolink E1 camera and neolink definitely seems to be able to connect and talk to it, judging by the debug output. When connecting with RTSP to it using VLC, I get a streaming error in VLC and one log-row in neolink:
[2020-06-20T19:30:03Z DEBUG neolink::gst] RTSP: media was configured

Attached is a log from the execution with the latest Windows CI-build (9a0eb56)
neolink-execution-9a0eb56.log

Can you find anything in the logs to indicate what can be done to support the E1 camera?
Thanks

VLC Connection Fails: "Cseq mismatch" & "only real/helix"

Using Window VLC Media Player for Windows 3.0.10 Vetinari on Windows 7. Connection failed.

Log reveal attempt to connect to the neolink proxy fails with "warning: Cseq mismatch, got 1, assumed 0" and "warning: only real/helix rtsp servers supported for now":

main debug: creating access: rtsp://ares:8554/garage_west
main debug:  (path: \\ares:8554\garage_west)
main debug: looking for access module matching "rtsp": 26 candidates
satip debug: try to open 'rtsp://ares:8554/garage_west'
satip debug: connect to host 'ares'
main debug: net: connecting to ares port 8554
main debug: connection succeeded (socket = 1196)
main debug: net: opening 0.0.0.0 datagram port 9478
main debug: net: opening 0.0.0.0 datagram port 9479
satip error: Failed to setup RTSP session
main debug: net: connecting to ares port 8554
main debug: connection succeeded (socket = 1228)
access_realrtsp warning: Cseq mismatch, got 1, assumed 0
access_realrtsp debug: rtsp connected
access_realrtsp warning: only real/helix rtsp servers supported for now
main debug: no access modules matched
main debug: dead input

See https://pastebin.com/ALEh4z9d (30 days from 5/22/2020)

addon/plugin/costume component For Home Assistant

Migrated from #44:

Hello All

It's possible to create a addon/plugin/costume component based in neolink to running in HA -Home Assistant

I think this can be useful once we can integrate the reolink cameras that is not supporting the RTSP or ONVIF protocols.

Converting in a supported devices to be available :)

Think about this please

Best regards

Timeout loop after update/reboot/disconnect/crash

When a camera is suddenly disconnected from the network by unplugging a cable, or Neolink crashes or is killed, sometimes the disconnected camera(s) will no longer stream with Neolink's stock timeout threshold once the camera is reconnected. Neolink will try to connect, will successfully reconnect, then will immediately time out, then reconnect again successfully, then time out again, and repeat the cycle indefinitely. This disconnect/timeout problem only happens sometimes, and very rarely. Most of the time, I can pull the plug on any of the cameras, reconnect, and everything works fine.

I can manually set the timeout threshold to the timeout-ing camera to 5 seconds in the Neolink config file, then it streams perfectly.

I also noticed that (on the rare occasion) after the camera is disconnected and begins to time out, the time and date overlay will disappear from the top of the feed. The date is reset to the year 2000 in the settings, and it won't display it on the feed until I sync the clock with the computer using the Reolink app.

Once I sync the system time with the camera, the date/time overlay will return to the top of the feed, and I can turn the timeout back down to one second in the Neolink config file for that camera and it streams perfectly, without any timeouts.

I'm not sure what's causing the camera's date and time settings to be destroyed, but I think that is what is causing the timeout issue. A workaround for this might be to figure out how the time is set on the camera via the Baichuan protocol, then have Neolink sync the system time with the camera on every successful reconnect.

Reolink E1 model with black image on stream

Hello

I just try to also get the image from the reolink E1 model, after a successfully get this work with a lumus as I mentioned in a last case. I just change the ip adress of the camera and the codec compression to the E1 used as mentioned in the configuration flie to the ;

[[cameras]]
name = "driveway"
username = "User"
password = "My Password"
address = "My IP address :9000"
# By default the camera is assumed to be in H.265 format
# Some camera's e.g. E1 use H.264. You can use the following to change this
format = "h264"

I just also restart the service with a stop and start command and also the server restart but without success for now?

Is there anything to perform in order to try solve this issue ?

Thank you in advance for your support and best regards

Report system time on connection errors.

It would be nice for neolink to print the system time in the command prompt window in the event of a connection/timeout error. This would be a helpful troubleshooting tool.

reolink B400 Timeout

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

Creating Packages

It would ease installation considerably if we had packages such as .deb or a Brewfile maybe even a choco.

I can make the macos one (Brewfile) although we'd need a permalink to a version which won't work with the current CI style deployment.

I might be able to make a deb one too, but I generally don't touch windows so I can't do the choco.

Implement Windows installer

The Windows installer should be an MSI package that:

  • provides the MSVC runtime and Gstreamer plugins as merge modules (static CRT link can then be removed).
  • installs a Start Menu icon
  • Runs as a Windows service
  • Pulls the configuration from C:\ProgramData\Neolink

Connection retry failure in the event of router reboot

Initial testing of the retry feature worked well. However, when I rebooted my router (which has all my cameras connected to it), neolink seemed not to notice a connection failure as it did before, and the video streams stopped. If I went to the command prompt window neolink was running in and pressed any key, neolink then displayed the connectivity error messages and reconnected to the cameras. The streams then showed up in my security software. I was able to repeat this several times.

Without "tickling" neolink in the command prompt, neolink will not reconnect to cameras in the event of a router reboot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.