QuantumEntangledAndy / neolink

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

Errors when streaming from Argus Eco #78

Closed mattlcbesc closed 11 months ago

mattlcbesc commented 1 year ago

Describe the bug Stream works in VLC on another PC on the LAN. However, it will not work with Frigate and also get errors using FFPROBE. FFPROBE confirms GSTREAMER is loading and producing data, but it is not ingesting any video stream it would appear.

To Reproduce Steps to reproduce the behavior. CONFIG:
bind = "192.168.27.114"

[[cameras]] name = "homesite" username = "admin" password = "10champs11" address = "192.168.27.105" uid = "95270000WZMJ0ZRY" format = "h264" [cameras.pause] on_motion = true # Should pause when no motion on_client = true # Should pause when no rtsp client timeout = 2.1 # How long to wait after motion stops before pausing

Expected behavior Stream should be readable from Frigate and not produce errors from FFPROBE.

Versions NVR software: Frigate 0.12.0 Neolink software: 0.5.8 Reolink camera model and firmware: Argus Eco 1202_491_352_19

NEOLINK Debug: https://pastebin.com/zy2iSBtC

FFPROBE Output: https://pastebin.com/AzS1pGFC

mattlcbesc commented 1 year ago
    - path: rtsp://192.168.27.114:8554/homesite # <----- The stream you want to use for detection

^^ Path used in Frigate for rtsp stream

Add'l logs from neolink:
[2023-05-03T16:20:03Z DEBUG neolink::rtsp::gst::sender] Video format set to: H264 from Unknown [2023-05-03T16:20:04Z DEBUG neolink::rtsp::gst::sender] Audio format set to: Aac from Unknown [2023-05-03T16:20:12Z DEBUG neolink::rtsp::gst::sender] Video format set to: H264 from Unknown [2023-05-03T16:20:13Z DEBUG neolink::rtsp::gst::sender] Audio format set to: Aac from Unknown [2023-05-03T16:20:31Z DEBUG neolink::rtsp::gst::factory] Building H264 Pipeline [2023-05-03T16:20:31Z DEBUG neolink::rtsp::gst::factory] Building Aac pipeline [2023-05-03T16:20:31Z DEBUG neolink::rtsp::gst::factory] Linking encoder to decoder: Some(Caps(audio/x-raw(memory:SystemMemory) { format: (gchararray) "S16LE", layout: (gchararray) "interleaved", rate: (gint) 16000, channels: (gint) 2, channel-mask: (GstBitmask) 0x0000000000000003 })) [2023-05-03T16:20:31Z DEBUG neolink::rtsp::gst::sender] Pushed Video Buffer: ms: 2987451152, st: 2984851152, delta: 2600000 [2023-05-03T16:20:31Z DEBUG neolink::rtsp::gst::sender] Failed to send buffer: Could not push buffer to appsrc [2023-05-03T16:20:41Z DEBUG neolink::rtsp::gst::factory] Building H264 Pipeline [2023-05-03T16:20:41Z DEBUG neolink::rtsp::gst::factory] Building Aac pipeline [2023-05-03T16:20:41Z DEBUG neolink::rtsp::gst::factory] Linking encoder to decoder: Some(Caps(audio/x-raw(memory:SystemMemory) { format: (gchararray) "S16LE", layout: (gchararray) "interleaved", rate: (gint) 16000, channels: (gint) 2, channel-mask: (GstBitmask) 0x0000000000000003 })) [2023-05-03T16:20:41Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:20:41Z DEBUG neolink::rtsp::gst::sender] Failed to send buffer: Could not push buffer to appsrc [2023-05-03T16:20:51Z DEBUG neolink::rtsp::gst::factory] Building H264 Pipeline [2023-05-03T16:20:51Z DEBUG neolink::rtsp::gst::factory] Building Aac pipeline [2023-05-03T16:20:51Z DEBUG neolink::rtsp::gst::factory] Linking encoder to decoder: Some(Caps(audio/x-raw(memory:SystemMemory) { format: (gchararray) "S16LE", layout: (gchararray) "interleaved", rate: (gint) 16000, channels: (gint) 2, channel-mask: (GstBitmask) 0x0000000000000003 })) [2023-05-03T16:20:51Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:20:51Z DEBUG neolink::rtsp::gst::sender] Failed to send buffer: Could not push buffer to appsrc [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::factory] Building H264 Pipeline [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::factory] Building Aac pipeline [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::factory] Linking encoder to decoder: Some(Caps(audio/x-raw(memory:SystemMemory) { format: (gchararray) "S16LE", layout: (gchararray) "interleaved", rate: (gint) 16000, channels: (gint) 2, channel-mask: (GstBitmask) 0x0000000000000003 })) [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::sender] Pushed Video Buffer: ms: 3016452152, st: 3016252152, delta: 200000 [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:21:01Z DEBUG neolink::rtsp::gst::sender] Pushed Video Buffer: ms: 3016652152, st: 3016252152, delta: 400000 [2023-05-03T16:21:02Z DEBUG neolink::rtsp::gst::sender] Pushed Audio Buffer [2023-05-03T16:21:02Z DEBUG neolink::rtsp::gst::sender] Failed to send buffer: Could not push buffer to appsrc [2023-05-03T16:21:06Z INFO neolink::rtsp] Pause buffer prepared [2023-05-03T16:21:06Z INFO neolink::rtsp] Await Client Pause [2023-05-03T16:21:06Z INFO neolink::rtsp] Client Pause [2023-05-03T16:21:06Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:06Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:06Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 4) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 3 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 4 (number: 5) [2023-05-03T16:21:07Z DEBUG neolink_core::bc_protocol::connection::bcconn] Ignoring uninteresting message id 4 (number: 4)

QuantumEntangledAndy commented 1 year ago

Might be best to test without pause on so we can eliminate the issue as comming from the start up time.

We are currently testing a rework of the stream data in #68 that might help with frigate. But the testers there are getting issue I can't replicate. Perhaps you can give it a try especially if your on another os

mattlcbesc commented 1 year ago

No change in what I'm seeing from Frigate. Here's an updated log from neolink: https://pastebin.com/KcjpWqhQ

ffprobe from the frigate system acts like it's not receiving any data now.

QuantumEntangledAndy commented 1 year ago

From what I can see with that. It's just that the rtsp stream in frigate is trying to run faster than the stream is pulling data. I'll see if I can smooth this out when I get a moment to work on the code

How are you viewing the stream in frigate? I've just gotten a setup for testing purposes but Ive never used it before. Are your looking at it from the webui or do I need to test the view on it's own rtsp feed?

mattlcbesc commented 1 year ago

I normally view from the standard webui. I did comment out the pause lines as well. Below is my config for the rtsp feed from neolink in frigate.

  homesite: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: rtsp://192.168.27.114:8554/homesite/subStream # <----- The stream you want to use for detection
          input_args: 
            - preset-rtsp-restream
          roles:
            - detect
            - record
QuantumEntangledAndy commented 1 year ago

Can you check again with the latest build? I've added some code to buffer and apply time stamps better for VLC and frigate that seems to be working for me

mattlcbesc commented 1 year ago

Video stream is working in Frigate. My log is getting spammed with this from gstreamer: buffer exhausted. Not enough data from Camera. Not sure if there's a setting camera side to set that. And by spammed, i mean about 20/second lol. Thanks for getting it this far. I'm happy to have a working video stream.

mattlcbesc commented 1 year ago

Also, i had to use go2rtc in Frigate to get the video feed working. Were you able to ingest the feed in Frigate directly from Neolink? Or did you have to go through go2rtc? Mind sharing your frigate camera settings if you didnt use go2rtc? Thanks

QuantumEntangledAndy commented 1 year ago

Buffer exhausted seems to happen when the video is too large to be handled quickly enough to be live. Try reducing the bit rate etc using the official app first.

I just used the default config in frigate. No options other than the address really.

QuantumEntangledAndy commented 1 year ago

Just thought I'd share the test docker and frigate setup I use

docker-compose.yml

version: "3.9"
services:
  frigate:
    image: ghcr.io/blakeblackshear/frigate:stable
    links:
      - neolink
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./frigate.yml:/config/config.yml
      - ./storage:/media/frigate
      - ./db:/db
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp
  neolink:
    image: quantumentangledandy/neolink:latest
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./neolink.toml:/etc/neolink.toml
    environment:
      RUST_LOG: "neolink=debug"

neolink.toml

bind = "0.0.0.0"

[[cameras]]
name = "ANAME"
username = "MYUSER"
password = "MYPASS"
address = "MYIP:9000"
uid = "MYUID"
stream = "subStream"

frigate.yml

database:
    path: /db/frigate.db

mqtt:
    enabled: false

cameras:
    ANAME:
      ffmpeg:
        inputs:
          - path: rtsp://neolink:8554/ANAME/subStream
      detect:
        enabled: False
        width: 1280 # <---- update for your camera's resolution
        height: 720
QuantumEntangledAndy commented 11 months ago

Do you think this can be closed? I'm hoping that latests fixes this as I've had a lot of work go into optimising the UDP streams

QuantumEntangledAndy commented 11 months ago

Closing because I think this is addressed in latest, but if not please re-open