roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.5k stars 154 forks source link

RTSP stream not connecting #696

Open jwill2385 opened 6 months ago

jwill2385 commented 6 months ago

Hello, I am using a Wyze Cam V3 with RTSP. I have verified the RTSP stream link works with both VLC media player and FFMPEG

I am trying to run Viseron with Docker-compose on a raspberry pi 4+. I can successfully load viseron from my local host however my camera view just keeps spinning indefinitely.

I am getting a Error [Tornado.access] -500 Get /api/v1/camera/camera_1/snapshot?rand=krqbt&width=638 (172.18.0.1)

any suggestions? Here is my config.yaml file. I think it may have something to do with the stream_format and making sure its showing rtsp and not mjpeg-stream `ffmpeg: camera: camera_1: name: test_camera host: !secret test_cam_ip path: /live port: 554 username: !secret username password: !secret password stream_format: rtsp fps: 6 width: 1920 height: 1080 codec: h264 audio_codec: null

darknet: object_detector: cameras: camera_1: fps: 1 scan_on_motion_only: false labels:

nvr: camera_1:

webserver:

logger: default_level: debug`

jwill2385 commented 6 months ago

Sorry my code snippet did not format correctly. Here is my config.yaml

ffmpeg:
  camera:
    camera_1:
      name: test_cam
      host: !secret test_cam_ip
      path: /live
      port: 554
      username: !secret username
      password: !secret password
      stream_format: rtsp
      fps: 6
      width: 1920
      height: 1080
      codec: h264
      audio_codec: null

  darknet:
     object_detector:
       cameras:
         camera_1:
           fps: 1
           scan_on_motion_only: false
           labels:
             - label: person
             confidence: 0.8
             trigger_recorder: true

nvr:
  camera_1:

webserver:

logger:
  default_level: debug 
roflcoopter commented 6 months ago

Any errors in the log? Your darknet section is over indented, it should not reside under ffmpeg

jwill2385 commented 6 months ago

@roflcoopter yes sorry I manually typed in the code snippet the indentation was correct on the actual config file. I also have commented out the darknet section and am still getting errrors with loading the video. the wheel just keeps spinning. Heres the new config file in full:

# Thanks for trying out Viseron!
# This is a small walkthrough of the configuration to get you started.
# There are far more components and options available than what is listed here.
# See the documentation for the full list of configuration options.

## Start by adding some cameras
ffmpeg:
  camera:
    camera_1:  # This value has to be unique across all cameras
      name: test_camera
      host: !secret  test_cam_ip
      port: 554
      path: /live
      username: !secret username
      password: !secret password
      stream_format: rtsp
      protocol: rtsp
      codec: h264
      audio_codec: pcm_a law
      fps: 6
      width: 1920
      height: 1080

    camera_2:
      name: <ok>
      host: <ok>
      port: <ok>
      path: <ok>
      username: <ok>
      password: <ok>
logger:
    default_level: debug

## Then add an object detector
# darknet:
#   object_detector:
#     cameras:
#       camera_1:  # Attach detector to the configured camera_1 above
#         fps: 1
#         scan_on_motion_only: false  # Scan for objects even when there is no motion
#         labels:
#           - label: person
#             confidence: 0.75
#             trigger_recorder: true

#       camera_2:  # Attach detector to the configured camera_2 above
#         fps: 1
#         labels:
#           - label: person
#             confidence: 0.75
#             trigger_recorder: true

## You can also use motion detection
# mog2:
#   motion_detector:
#     cameras:
#       camera_2:  # Attach detector to the configured camera_2 above
#         fps: 1

## To tie everything together we need to configure one more component.
nvr:
  camera_1:  # Run NVR for camera_1
  camera_2:  # Run NVR for camera_2

webserver:
  port: 8888

# Now you can restart Viseron and you should be good to go!

When I click on the live view button interesting enough it goes to a /mjpeg-stream endpoint and says Camera camera_1 not found Here are the logs of the error.

viseron_error_1 viseron_error_2

roflcoopter commented 6 months ago

The first error is because you need to have at least one object detector or motion detector configured. Can you enable at least one, then restart and send the logs please? The 500 on GET of snapshot is because the setup failed for some reason

jwill2385 commented 6 months ago

@roflcoopter Yes I tried enabling both the object dector and motion dector, just the object detector, and just the motion detector with no luck. Here is the config file for just mog

# Thanks for trying out Viseron!
# This is a small walkthrough of the configuration to get you started.
# There are far more components and options available than what is listed here.
# See the documentation for the full list of configuration options.

## Start by adding some cameras
ffmpeg:
  camera:
    camera_1:  # This value has to be unique across all cameras
      name: test_camera
      host: !secret  test_cam_ip
      port: 554
      path: /live
      username: !secret username
      password: !secret password
      stream_format: rtsp
      protocol: rtsp
      codec: h264
      audio_codec: pcm_a law
      fps: 6
      width: 1920
      height: 1080

    # camera_2:
    #   name: <ok>
    #   host: <ok>
    #   port: <ok>
    #   path: <ok>
    #   username: <ok>
    #   password: <ok>
logger:
    default_level: debug

# Then add an object detector
# darknet:
#   object_detector:
#     cameras:
#       camera_1:  # Attach detector to the configured camera_1 above
#         fps: 1
#         scan_on_motion_only: true  # Scan for objects even when there is no motion
#         labels:
#           - label: person
#             confidence: 0.75
#             trigger_recorder: true

#       camera_2:  # Attach detector to the configured camera_2 above
#         fps: 1
#         labels:
#           - label: person
#             confidence: 0.75
#             trigger_recorder: true

# You can also use motion detection
mog1:
  motion_detector:
    cameras:
      camera_1:  # Attach detector to the configured camera_2 above
        fps: 1

## To tie everything together we need to configure one more component.
nvr:
  camera_1:  # Run NVR for camera_1
  # camera_2:  # Run NVR for camera_2

webserver:
  port: 8888

# Now you can restart Viseron and you should be good to go!

I am still getting the failed to setup error at least one object or motion detector has to be configured. 2024-01-02-203136_1920x1080_scrot 2024-01-02-203457_1920x1080_scrot

roflcoopter commented 6 months ago

I need to see the entire log from the start to be able to understand what's going on, can you try piping it to a file and attach it here?

jwill2385 commented 6 months ago

error_log.txt Ok I just attached the error logs. The most recent are from 01-04-2024 (Today). These logs correspond to the config file where darknet is enabled but the mog1 is commented out.

Looks like the error is FileNotFoundError: [Errno 2] No such file or directory: '/detectors/models/darknet/coco.names' Do I need to install darknet on my raspberry pi and store the coco names file in my viseron docker folder?

roflcoopter commented 5 months ago

I think thats en error on my part actually, that the file /detectors/models/darknet/coco.names is missing for the Raspberry Pi image. You dont need to install Darknet on your Pi since it is included in the image.

I need to make a fix so that the file is properly included.

In the meantime you can copy the file to your config folder by following these steps:

1) Copy the contents of this file: https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names to your Viseron config folder in a file called coco.names 2) Update your darknet config section and add label_path: /config/coco.names