Release 0.5.0
This commit is contained in:
4 files changed
+115
-307
No files matched your search
+3
-3
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "neolink"
|
||||
description = "A standards-compliant bridge to Reolink IP cameras"
|
||||
version = "0.4.0"
|
||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>"]
|
||||
version = "0.5.0"
|
||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
@@ -11,7 +11,7 @@ members = [
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
neolink_core = { path = "crates/core", version = "0.4.0" }
|
||||
neolink_core = { path = "crates/core", version = "0.5.0" }
|
||||
aes = "0.6"
|
||||
cfb-mode = "0.6"
|
||||
cookie-factory = "0.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Neolink
|
||||
|
||||

|
||||

|
||||
|
||||
Neolink is a small program that acts as a proxy between Reolink IP cameras and
|
||||
normal RTSP clients.
|
||||
@@ -16,337 +16,145 @@ camera.
|
||||
The Neolink project is not affiliated with Reolink in any way; everything it
|
||||
does has been reverse engineered.
|
||||
|
||||
## Supported cameras
|
||||
## This Fork
|
||||
|
||||
Neolink intends to support all Reolink cameras that do not provide native RTSP.
|
||||
Currently it has been tested on the following cameras:
|
||||
This fork is an extension of [thirtythreeforty's](https://github.com/thirtythreeforty/neolink)
|
||||
with additional features not yet in upstream master.
|
||||
|
||||
- B800/D800
|
||||
- B400/D400
|
||||
- E1
|
||||
- Lumus
|
||||
- 510A
|
||||
**Major Features**:
|
||||
|
||||
Neolink does not support other cameras such as the RLC-420, since they already
|
||||
[provide native RTSP](https://support.reolink.com/hc/en-us/articles/360007010473-How-to-Live-View-Reolink-Cameras-via-VLC-Media-Player).
|
||||
- MQTT
|
||||
- Motion Detection
|
||||
- Paused Streams (when no rtsp client or no motion detected)
|
||||
|
||||
## Usage
|
||||
**Minor Features**:
|
||||
|
||||
1. First, write a configuration yaml file describing your cameras. See the
|
||||
Configuration section below or the provided sample config.
|
||||
- Improved error messages when your missing gstreamer plugins
|
||||
- Protocol more closely follows offical reolink format
|
||||
- Possibly can handle more simulatenous connections
|
||||
|
||||
2. Launch Neolink:
|
||||
## Installation
|
||||
|
||||
Download from the [release page](https://github.com/QuantumEntangledAndy/neolink/releases)
|
||||
|
||||
Extract the zip
|
||||
|
||||
Install the latest [gstreamer](https://gstreamer.freedesktop.org/download/) (1.20.5 as of writing this).
|
||||
- **Windows**: ensure you install `full` when prompted in the MSI options.
|
||||
- **Mac**: Install the dpkg version on the offical gstreamer website over the brew version
|
||||
- **Ubuntu/Debian**: These packages should work
|
||||
```bash
|
||||
neolink rtsp --config=your_config.yaml
|
||||
sudo apt install \
|
||||
libgstrtspserver-1.0-0 \
|
||||
libgstreamer1.0-0 \
|
||||
libgstreamer-plugins-bad1.0-0 \
|
||||
gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-bad
|
||||
```
|
||||
|
||||
3. Then, connect your RTSP viewer to `rtsp://127.0.0.1:8554/your_camera_name`!
|
||||
Make a config file see below.
|
||||
|
||||
### Additional commands
|
||||
|
||||
Neolink also has some additional command line tools
|
||||
for controlling the camera. They are all used through neolink subcommands like this:
|
||||
## Config/Usage
|
||||
|
||||
### RTSP
|
||||
|
||||
To use neolinks you need a config file.
|
||||
|
||||
There's a more complete example [here](https://github.com/QuantumEntangledAndy/neolink/blob/master/sample_config.toml),
|
||||
but the following should work as a minimal example.
|
||||
|
||||
```toml
|
||||
bind = "0.0.0.0"
|
||||
|
||||
[[cameras]]
|
||||
name = "Camera01"
|
||||
username = "admin"
|
||||
password = "password"
|
||||
uid = "ABCDEF0123456789"
|
||||
|
||||
[[cameras]]
|
||||
name = "Camera02"
|
||||
username = "admin"
|
||||
password = "password"
|
||||
uid = "BCDEF0123456789A"
|
||||
```
|
||||
|
||||
Create a text file with those contents named `neolink.toml` in the same folder as neolink and then run the following command
|
||||
in your terminal in the same folder as neolink and the config file.
|
||||
|
||||
```bash
|
||||
neolink subcommand --config=...
|
||||
./neolink rtsp --config=neolink.toml
|
||||
```
|
||||
|
||||
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.
|
||||
### MQTT
|
||||
|
||||
For a full list of commands use `neolink help`, or use
|
||||
`neolink help <subcommand>` for details on a subcommand of interest.
|
||||
To use mqtt you will to adjust your config file as such:
|
||||
|
||||
## Download & Installation
|
||||
```toml
|
||||
bind = "0.0.0.0"
|
||||
|
||||
Builds are provided for the following platforms:
|
||||
[[cameras]]
|
||||
name = "Camera01"
|
||||
username = "admin"
|
||||
password = "password"
|
||||
uid = "ABCDEF0123456789"
|
||||
[cameras.mqtt]
|
||||
server = "127.0.0.1" # Address of the mqtt server
|
||||
port = 1883 # mqtt servers port
|
||||
credentials = ["username", "password"] # mqtt server login details
|
||||
```
|
||||
|
||||
- Windows x86_64 ([download][win-ci-download])
|
||||
- macOS x86_64 ([download][macos-ci-download])
|
||||
- Ubuntu/Debian x86_64 ([download][ubuntu-ci-download])
|
||||
- Ubuntu/Debian x86 ([download][debian-x86-ci-download])
|
||||
- Debian aarch64 (Raspberry Pi 64-bit) ([download][debian-aarch-ci-download])
|
||||
- Debian armhf (Raspberry Pi 32-bit) ([download][debian-armhf-ci-download])
|
||||
- Arch Linux ([AUR](https://aur.archlinux.org/packages/neolink-git/))
|
||||
- Docker x86 (see below)
|
||||
|
||||
### Windows/Linux
|
||||
|
||||
1. [Install Gstreamer][gstreamer] from the most recent MSI installer on Windows,
|
||||
or your package manager on Linux.
|
||||
|
||||
On Ubuntu/Debian machines gstreamer can be installed with:
|
||||
|
||||
```bash
|
||||
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][ci-download] 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:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
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.
|
||||
|
||||
[gstreamer]: https://gstreamer.freedesktop.org/documentation/installing/index.html
|
||||
[ci-download]: https://github.com/thirtythreeforty/neolink/actions?query=workflow%3ACI+branch%3Amaster+
|
||||
|
||||
[win-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-windows-2022.zip
|
||||
[macos-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-macos-12.zip
|
||||
[ubuntu-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-ubuntu-20.04.zip
|
||||
[debian-x86-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-i386-buster.zip
|
||||
[debian-armhf-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-armhf-buster.zip
|
||||
[debian-aarch-ci-download]: https://nightly.link/thirtythreeforty/neolink/workflows/build/master/release-arm64-buster.zip
|
||||
|
||||
### 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:
|
||||
Then to start the mqtt connection run the following:
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-p 8554:8554 \
|
||||
--restart=on-failure \
|
||||
--volume=$PWD/config.toml:/etc/neolink.toml \
|
||||
thirtythreeforty/neolink
|
||||
./neolink mqtt --config=neolink.toml
|
||||
```
|
||||
|
||||
Here is an example docker-compose:
|
||||
Neolink will publish these messages:
|
||||
|
||||
```yml
|
||||
---
|
||||
version: "2"
|
||||
services:
|
||||
neolink:
|
||||
image: thirtythreeforty/neolink
|
||||
container_name: neolink
|
||||
ports:
|
||||
- 8554:8554
|
||||
volumes:
|
||||
- $PWD/neolink.toml:/etc/neolink.toml
|
||||
restart: unless-stopped
|
||||
Messages are prefixed with `neolink/{CAMERANAME}`
|
||||
|
||||
Control messages:
|
||||
- `/control/led [on|off]` Turns status LED on/off
|
||||
- `/control/ir [on|off|auto]` Turn IR lights on/off or automatically via light detection
|
||||
- `/control/reboot` Reboot the camera
|
||||
- `/control/ptz` [up|down|left|right|in|out] (amount) Control the PTZ movements, amount defaults to 32.0
|
||||
|
||||
Status Messages:
|
||||
`/status offline` Sent when the neolink goes offline this is a LastWill message
|
||||
`/status disconnected` Sent when the camera goes offline
|
||||
`/status/battery` Sent in reply to a `/query/battery`
|
||||
|
||||
Query Messages:
|
||||
`/query/battery` Request that the camera reports its battery level (Not Yet Implemented)
|
||||
|
||||
### Pause
|
||||
|
||||
To use the pause featrue you will need to adjust your config file as such:
|
||||
|
||||
```toml
|
||||
bind = "0.0.0.0"
|
||||
|
||||
[[cameras]]
|
||||
name = "Camera01"
|
||||
username = "admin"
|
||||
password = "password"
|
||||
uid = "ABCDEF0123456789"
|
||||
[cameras.pause]
|
||||
on_motion = true # Should pause when no motion
|
||||
on_client = false # Should pause when no rtsp client
|
||||
mode = "none" # What to do when paused values are: none, black, still, test
|
||||
timeout = 2.1 # How long to wait after motion stops before pausing
|
||||
```
|
||||
|
||||
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](https://docs.docker.com/network/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](https://github.com/docker/for-linux/issues/637)
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
**Note**: for a more comprehensive setup tutorial, refer to the
|
||||
[Blue Iris setup walkthrough in `docs/`][blue-iris-setup] (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][unix-setup]
|
||||
|
||||
**Note**: instructions for also setting up a (systemd based) service for linux
|
||||
based devices is provided in [docs/unix_service.md][unix-service]
|
||||
|
||||
[blue-iris-setup]: docs/Setting%20Up%20Neolink%20For%20Use%20With%20Blue%20Iris.md
|
||||
[unix-setup]: docs/unix_setup.md
|
||||
[unix-service]: 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:
|
||||
|
||||
```sh
|
||||
set RUST_LOG=debug
|
||||
```
|
||||
|
||||
- On Bash:
|
||||
Then start the rtsp server as usual:
|
||||
|
||||
```bash
|
||||
export RUST_LOG=debug
|
||||
./neolink rtsp --config=neolink.toml
|
||||
```
|
||||
|
||||
## 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:
|
||||
|
||||
```bash
|
||||
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/`](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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "neolink_core"
|
||||
description = "Core services and structure for Reolink IP cameras"
|
||||
version = "0.4.0"
|
||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>"]
|
||||
version = "0.5.0"
|
||||
authors = ["George Hilliard <thirtythreeforty@gmail.com>", "Andrew King <sheepchaan@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ use log::*;
|
||||
/// Control messages:
|
||||
///
|
||||
/// - `/control/led [on|off]` Turns status LED on/off
|
||||
/// - `/control/ir [on|off|auti]` Turn IR lights on/off or automatically via light detection
|
||||
/// - `/control/ir [on|off|auto]` Turn IR lights on/off or automatically via light detection
|
||||
/// - `/control/reboot` Reboot the camera
|
||||
/// - `/control/ptz` [up|down|left|right|in|out] (amount) Control the PTZ movements, amount defaults to 32.0
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user