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.51k stars 155 forks source link

FFprobe command timed out (Ubiquiti UniFi Protect UVC G3 Flex) #681

Closed vchrizz closed 8 months ago

vchrizz commented 8 months ago

Hi,

running this the first time the WebGUI shows "Waiting for cameras to register". I guess at first a new user has to understand to configure cameras before running the container. So I configured my camera, but the issue is the same. After some hours of debugging with tcpdump, looking at the logs as recommended and not understanding why FFprobe times out while the camera is reachable from the container and the cam even sends udp data to the container, suddenly the whole thing works without changing anything.

Then stopped/started the container and the issue is reproducible here again, letting it run within screen over night I noticed it working the next day.

What could be the issue that I have to wait some hours until viseron finally works as expected? Until the camera is registered, it is not possible to view recordings and the WebGUI shows the mentioned error all the time.

my config:

ffmpeg:
  camera:
    camera_1:  # This value has to be unique across all cameras
      name: MyCam1
      host: 10.5.45.251
      port: 554
      path: /s0

## 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

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

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

edgetpu: # https://viseron.netlify.app/components-explorer/components/edgetpu
  object_detector:
    cameras:
      camera_1:
        fps: 1
        labels:
          - label: person
            confidence: 0.8
  image_classification:
    #device: cpu
    device: usb # Use any USB Edge TPU
    cameras:
      camera_1:
    labels:
      - person

logger:
  logs:
    viseron.components.ffmpeg: debug
    viseron.components.mog2: debug
    viseron.components.darknet: debug
    viseron.components.nvr: debug

logs:

...
[2023-10-19 02:21:25] [INFO    ] [viseron.core] - -------------------------------------------
[2023-10-19 02:21:25] [INFO    ] [viseron.core] - Initializing Viseron
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component logger
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component logger took 0.0 seconds
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component data_stream
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component data_stream took 0.0 seconds
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component webserver
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component webserver took 0.0 seconds
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component ffmpeg
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component mog2
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component darknet
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component edgetpu
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setting up component nvr
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component nvr took 0.0 seconds
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component mog2 took 0.0 seconds
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component ffmpeg took 0.0 seconds
[2023-10-19 02:21:25] [DEBUG   ] [viseron.components.darknet] - Using OpenCV DNN Darknet
[2023-10-19 02:21:25] [DEBUG   ] [viseron.components.darknet] - Using weights /detectors/models/darknet/default.weights and config /detectors/models/darknet/default.cfg, 640x640
[2023-10-19 02:21:25] [DEBUG   ] [viseron.components.darknet] - DNN backend: 0
[2023-10-19 02:21:25] [DEBUG   ] [viseron.components.darknet] - DNN target: 0
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component edgetpu took 0.0 seconds
[2023-10-19 02:21:25] [WARNING ] [viseron.components] - Domain object_detector with identifier camera_1 already in setup queue. Skipping setup of domain object_detector with identifier camera_1 for component darknet
[2023-10-19 02:21:25] [INFO    ] [viseron.components] - Setup of component darknet took 0.3 seconds
[2023-10-19 02:21:26] [INFO    ] [viseron.components] - Setting up domain camera for component ffmpeg with identifier camera_1
[2023-10-19 02:21:26] [INFO    ] [viseron.components] - Setting up domain object_detector for component edgetpu with identifier camera_1
[2023-10-19 02:21:26] [INFO    ] [viseron.components] - Setting up domain motion_detector for component mog2 with identifier camera_1
[2023-10-19 02:21:26] [INFO    ] [viseron.components] - Setting up domain nvr for component nvr with identifier camera_1
[2023-10-19 02:21:26] [INFO    ] [viseron.components] - Setting up domain image_classification for component edgetpu with identifier camera_1
[2023-10-19 02:21:26] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - Getting stream information for rtsp://10.5.45.251:554/s0
[2023-10-19 02:21:26] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - FFprobe command: ffprobe -hide_banner -loglevel error -print_format json -show_error -show_entries stream=codec_type,codec_name,width,height,avg_frame_rate rtsp://10.5.45.251:554/s0
[2023-10-19 02:21:41] [ERROR   ] [viseron.components.ffmpeg.stream.camera_1] - Retrying None in 2.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 15s.
[2023-10-19 02:21:46] [WARNING ] [viseron.components] - Setup of domain camera for component ffmpeg with identifier camera_1 is taking longer than 20 seconds
[2023-10-19 02:22:13] [ERROR   ] [viseron.components.ffmpeg.stream.camera_1] - Retrying None in 4.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 30s.
[2023-10-19 02:22:26] [WARNING ] [viseron.components] - Domain nvr for component nvr with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: object_detector, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:22:26] [WARNING ] [viseron.components] - Domain object_detector for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:22:26] [WARNING ] [viseron.components] - Domain image_classification for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:22:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:23:02] [ERROR   ] [viseron.components.ffmpeg.stream.camera_1] - Retrying None in 8.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 45s.
[2023-10-19 02:23:26] [WARNING ] [viseron.components] - Domain nvr for component nvr with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: object_detector, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:23:26] [WARNING ] [viseron.components] - Domain object_detector for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:23:26] [WARNING ] [viseron.components] - Domain image_classification for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:23:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:24:10] [ERROR   ] [viseron.components.ffmpeg.stream.camera_1] - Retrying None in 16.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 60s.
[2023-10-19 02:24:26] [WARNING ] [viseron.components] - Domain nvr for component nvr with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: object_detector, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:24:26] [WARNING ] [viseron.components] - Domain object_detector for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:24:26] [WARNING ] [viseron.components] - Domain image_classification for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:24:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:25:26] [WARNING ] [viseron.components] - Domain nvr for component nvr with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: object_detector, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:25:26] [WARNING ] [viseron.components] - Domain object_detector for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:25:26] [WARNING ] [viseron.components] - Domain image_classification for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:25:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
...
[2023-10-19 02:37:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:38:12] [ERROR   ] [viseron.components] - Domain camera for component ffmpeg is not ready. Retrying in 10 seconds. Error: FFprobe command timed out after 150s
[2023-10-19 02:38:22] [INFO    ] [viseron.components] - Setting up domain camera for component ffmpeg with identifier camera_1, attempt 2
[2023-10-19 02:38:22] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - Getting stream information for rtsp://10.5.45.251:554/s0
[2023-10-19 02:38:22] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - FFprobe command: ffprobe -hide_banner -loglevel error -print_format json -show_error -show_entries stream=codec_type,codec_name,width,height,avg_frame_rate rtsp://10.5.45.251:554/s0
[2023-10-19 02:38:26] [WARNING ] [viseron.components] - Domain nvr for component nvr with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: object_detector, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
...
[2023-10-19 02:55:26] [WARNING ] [viseron.components] - Domain image_classification for component edgetpu with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1', 'domain: motion_detector, identifier: camera_1']
[2023-10-19 02:55:26] [WARNING ] [viseron.components] - Domain motion_detector for component mog2 with identifier camera_1 is still waiting for dependencies: ['domain: camera, identifier: camera_1']
[2023-10-19 02:55:28] [INFO    ] [viseron.components] - Setting up domain camera for component ffmpeg with identifier camera_1, attempt 3
[2023-10-19 02:55:28] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - Getting stream information for rtsp://10.5.45.251:554/s0
[2023-10-19 02:55:28] [DEBUG   ] [viseron.components.ffmpeg.stream.camera_1] - FFprobe command: ffprobe -hide_banner -loglevel error -print_format json -show_error -show_entries stream=codec_type,codec_name,width,height,avg_frame_rate rtsp://10.5.45.251:554/s0
[2023-10-19 02:55:43] [ERROR   ] [viseron.components.ffmpeg.stream.camera_1] - Retrying None in 2.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 15s.
...

Thank you!

vchrizz commented 8 months ago

After reading #207 I tried to set following configuration which helped in my case using a Ubiquiti UniFi Protect UVC G3 Flex camera to get the stream started:

## Start by adding some cameras
ffmpeg:
  camera:
    # This value has to be unique across all cameras
    camera_1:
      name: MyCam1
      host: 10.5.45.251
      port: 554
      path: /s0
      width: 1920
      height: 1080
      fps: 25
      codec: h264
      audio_codec: aac
      stream_format: rtsp
      ffprobe_loglevel: debug