QuantumEntangledAndy / neolink

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

Unable to view rtsp stream with vlc: Windows/Docker/WSL issue #139

Closed tmyngu11 closed 1 year ago

tmyngu11 commented 1 year ago

Describe the bug I have set up the docker container and it seems to have been set up correctly, but when I try to view the RTSP stream in VLC, it can't connect. It may be that I am not using the correct stream but I was unable to find any tutorial about this.

Here are my docker logs:

2023-08-22 21:42:20 [2023-08-23T01:42:20Z INFO  neolink_core::bc_protocol] fishcam: Remote discovery success 95270005VAFE195G at 192.168.1.167:40775
2023-08-22 21:42:21 [2023-08-23T01:42:21Z INFO  neolink::rtsp::states::loggedin] fishcam: Camera time is already set: 2023-08-22 21:42:21.0 +05:00:00
2023-08-22 21:42:22 [2023-08-23T01:42:22Z INFO  neolink::rtsp::states::loggedin] fishcam: Camera reports firmware version v3.0.0.1981_23040606
2023-08-22 21:42:22 [2023-08-23T01:42:22Z INFO  neolink::rtsp::states::streaming] fishcam: Starting video stream Main Stream (Clear)
2023-08-22 21:42:27 [2023-08-23T01:42:27Z INFO  neolink::rtsp] fishcam: Buffers prepared

I have tried the following network streams in VLC:

rtsp://127.0.0.1:8554/fishcam
rtsp://localhost:8554/fishcam
rtsp://127.0.0.1:8554/fishcam/mainStream

my neolink.toml:

bind = "0.0.0.0"
[[cameras]]
name = "fishcam"
username = "admin"
password ="mypassword"
uid = "MYUID"
stream = "mainStream" # also tried without this to no avail

Expected behavior stream shows up in VLC

Versions NVR software: n/a Neolink software: 0.5.18 docker Reolink camera model and firmware: Reolink Argus Eco, v3.0.0.1981_23040606

QuantumEntangledAndy commented 1 year ago

Can you provide details of the docker command. Docker creates its own sub-network and you may need to use dockers internal ip address. Also your OS because the way docker does its internal network differs on each machine

tmyngu11 commented 1 year ago

@QuantumEntangledAndy thanks for the quick reply!

here is my docker compose:

---
version: "2"
services:
  neolink:
    image: quantumentangledandy/neolink
    container_name: neolink
    network_mode: "host"
    ports:
      - 8554:8554
    volumes:
      - /mnt/service/neolink/neolink.toml:/etc/neolink.toml
    restart: unless-stopped
QuantumEntangledAndy commented 1 year ago

The OS ect too please and the details of any VLC errors. This just looks like the standard port forwarding and docker subnet issues. How familiar are you with these sort of things? Are you aware that docker create its own private subnet and that extra work is done to try and forward data through?

tmyngu11 commented 1 year ago

OS: Windows with docker on wsl VLC Errors:

Connection failed:
VLC could not connect to "127.0.0.1:8554".
Your input can't be opened:
VLC is unable to open the MRL 'rtsp://127.0.0.1:8554/fishcam/mainStream'. Check the log for details.

I'm somewhat familiar, but I assumed using network_mode: "host" would skip those steps and directly allow the ports. currently, the container that is running neolink does not have an IP address whereas my other containers do. I'll try to do some more debugging.

which stream would be correct though? 'rtsp://127.0.0.1:8554/fishcam/mainStreamor 'rtsp://127.0.0.1:8554/fishcam

QuantumEntangledAndy commented 1 year ago

host mode only work on Linux. Docker on macos and windows is kind of run in a tiny linux virtual machine, so host dosen't work in the same way. There are other modes that can help I'm not sure if theyll help

QuantumEntangledAndy commented 1 year ago

If I had to guess because it is being run in wsl and docker on windows the ip address is NOT 127.0.0.1 or localhost

QuantumEntangledAndy commented 1 year ago

In WSL open a terminal and run ip a | grep eth0 to get your wsl interal ip address

tmyngu11 commented 1 year ago

@QuantumEntangledAndy Thank you! It seems the culprit was exactly that. removing the host option allows me to view it now lol.

I was banging my head against a wall for hours so I greatly appreciate the help!

QuantumEntangledAndy commented 1 year ago

Alright glad to see this wasn't too much trouble. Some of these docker/wsl/windows things create a lot of trouble since there are so many network layer on top of network layer that just adds extra points of failure

Anyways closing, if you need more help please open a new issue