QuantumEntangledAndy / neolink

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

`neolink image` - Higher quality image #162

Closed pmoon00 closed 2 months ago

pmoon00 commented 9 months ago

Tech Details

Camera: Reolink Argus 2E Platform: Docker (running own command instead of the default built in neolink command)

Feature Request

The neolink image command doesn't have the ability to change the image quality. It seems to always return a 640x360 image, which looks to be the "Fluent" quality Reolink offers. Is it possible to get a image using the "Clear" stream which is a higher resolution?

If the above is possible it would be great to be able to choose the quality using another flag when using the neolink image command.

Things I've Tried

QuantumEntangledAndy commented 9 months ago

Here's the relevant code lines https://github.com/QuantumEntangledAndy/neolink/blob/776c63a1bfb8492d48b25b8d939bc3ad988d73ea/crates/core/src/bc_protocol/snap.rs#L26-L36

You can see that we already request the stream type "main"

QuantumEntangledAndy commented 9 months ago

When I get the chance I'll check out what's happening with the use-stream option. But busy day today.

pmoon00 commented 9 months ago

Here's the relevant code lines

https://github.com/QuantumEntangledAndy/neolink/blob/776c63a1bfb8492d48b25b8d939bc3ad988d73ea/crates/core/src/bc_protocol/snap.rs#L26-L36

You can see that we already request the stream type "main"

Oh right that makes sense. I think when I use subStream it is the higher resolution stream.

Edit: When I've used the RTSP stream in the past, subStream was the higher resolution stream.

QuantumEntangledAndy commented 9 months ago

Can you check in your Reolink official client what you have set it to? The default is the mainstream is larger but maybe you've adjusted that.

pmoon00 commented 9 months ago

Can you check in your Reolink official client what you have set it to? The default is the mainstream is larger but maybe you've adjusted that.

I don't see anything in the app settings that lets me pick a default stream quality. Just a quality switcher in the app while streaming.

QuantumEntangledAndy commented 9 months ago

For my Argus 2E using the iOS app it's under. Display/Stream/Clear/Resolution

pmoon00 commented 9 months ago

I've had a look but nothing seems to indicate which one is the "default" stream.

Is this what you see?

image

QuantumEntangledAndy commented 9 months ago

That's the information I wanted to see. The clear is internally called mainStream and the fluent is internally called subStream.

Since in the code I linked earlier we request the "main" stream I would have thought we'd get the clear one. I'll have a look at it when I can to see if anything is amiss with it.

QuantumEntangledAndy commented 9 months ago

What happens when you use --use-stream how long does it hang for? It can take a little time because of the added work required to start and transcode the stream

pmoon00 commented 9 months ago

What happens when you use --use-stream how long does it hang for? It can take a little time because of the added work required to start and transcode the stream

I waited about two minutes and then cancelled the command.

QuantumEntangledAndy commented 9 months ago

Hmm I am not seeing this hang on latest. Can you test this build

docker pull quantumentangledandy/neolink:feature-push_mqtt

There have been a few changes since the last release so hopefully it is already fixed

QuantumEntangledAndy commented 9 months ago

For reference it takes about 20s for me to connect and get enough data for a jpeg image

Could you please set the environmental variable RUST_LOG to "neolink=debug" in your docker then send me the log while using --use-stream

That should tell me whats going on

QuantumEntangledAndy commented 9 months ago

So from testing I cannot seem to reliably control which image I get. For my E1 camera I get the subStream for my Argus2E I get the main stream

pmoon00 commented 9 months ago

Ah I am using the relay mode because my cameras are at another location, could that be the problem?

I'll run it as you've specified and get back to you.

pmoon00 commented 9 months ago

So from testing I cannot seem to reliably control which image I get. For my E1 camera I get the subStream for my Argus2E I get the main stream

Is this without the --use-stream flag?

pmoon00 commented 9 months ago

Hmm I am not seeing this hang on latest. Can you test this build

docker pull quantumentangledandy/neolink:feature-push_mqtt

There have been a few changes since the last release so hopefully it is already fixed

Using this tagged image works 👍

QuantumEntangledAndy commented 9 months ago

So from testing I cannot seem to reliably control which image I get. For my E1 camera I get the subStream for my Argus2E I get the main stream

Is this without the --use-stream flag?

Yes this is for without the use_stream

QuantumEntangledAndy commented 9 months ago

Using this tagged image works 👍

Ok I'll close this after the next release

ranchercams commented 8 months ago

Working with @QuantumEntangledAndy we discovered that adding channel_id=1 (or 0 or whatever) to each cameras config entry will make it use the secondary camera

pmoon00 commented 8 months ago

I've tried using channel_id 0-7, the only one that would successfully return an image was when it was channel id 0.

Config

bind = "0.0.0.0"

[[cameras]]
name = "CAMERA"
username = "admin"
password = "***************"
uid = "XXXXXXXXXXXXX"
discovery = "relay"
channel_id = 0

Here's an example of what I ran with the channel_id that was non-zero, i.e. 1

neolink image --config=/etc/neolink.toml --file-path=/images/test2.jpg CAMERA
[2023-10-26T06:33:30Z INFO  neolink] Neolink 3d0f8b794ec2f558ff6c32dcc3231fc4963eaab8 release
[2023-10-26T06:33:30Z INFO  neolink::utils] CAMERA: Connecting to camera at UID: XXXXXXXXXXXXX
[2023-10-26T06:33:30Z INFO  neolink_core::bc_protocol] CAMERA: Trying local discovery
[2023-10-26T06:33:33Z INFO  neolink_core::bc_protocol] CAMERA: Trying remote discovery
[2023-10-26T06:33:34Z INFO  neolink_core::bc_protocol] CAMERA: Trying map discovery
[2023-10-26T06:33:34Z INFO  neolink_core::bc_protocol] CAMERA: Trying relay discovery
[2023-10-26T06:33:36Z INFO  neolink_core::bc_protocol] CAMERA: Relay success XXXXXXXXXXXXX at 1XX.1XX.1XX.11:51104
[2023-10-26T06:33:37Z INFO  neolink::utils] CAMERA: Logging in
[2023-10-26T06:33:40Z INFO  neolink::utils] CAMERA: Connected and logged in
[2023-10-26T06:33:41Z INFO  neolink::common::camthread] CAMERA: Camera time is already set: 2023-10-26 19:33:45.0 -12:00:00
[2023-10-26T06:33:42Z INFO  neolink::common::neocam] CAMERA: Model Reolink Argus 2E
[2023-10-26T06:33:42Z INFO  neolink::common::neocam] CAMERA: Firmware Version v3.0.0.1488_22110302
Error: Camera responded with Service Unavaliable