blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.8k stars 1.71k forks source link

Errors when main stream + sub stream added #1249

Closed D34DC3N73R closed 3 years ago

D34DC3N73R commented 3 years ago

Describe the bug I'm unable to add both the sub-stream and the main-stream of a hikvision DS-HD1 doorbell. I can add either the sub-stream of the main-stream successfully, but not both. When I try to add them both, I get the following error.

 * Starting nginx nginx
   ...done.
frigate.app                    WARNING : Camera doorbell has record assigned to an input, but record is not enabled.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
detector.cpu1                  INFO    : Starting detection process: 50
detector.cpu2                  INFO    : Starting detection process: 52
detector.cpu4                  INFO    : Starting detection process: 55
detector.cpu3                  INFO    : Starting detection process: 54
frigate.app                    INFO    : Camera processor started for doorbell: 59
frigate.app                    INFO    : Capture process started for doorbell: 60
ffmpeg.doorbell.clips_rtmp     ERROR   : [rtsp @ 0x5572c6845bc0] Missing PPS in sprop-parameter-sets, ignoring
ffmpeg.doorbell.clips_rtmp     ERROR   : [rtsp @ 0x5572c6845bc0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
ffmpeg.doorbell.clips_rtmp     ERROR   : Consider increasing the value for the 'analyzeduration' and 'probesize' options
ffmpeg.doorbell.clips_rtmp     ERROR   : Output file #0 does not contain any stream
watchdog.doorbell              INFO    : Terminating the existing ffmpeg process...
watchdog.doorbell              INFO    : Waiting for ffmpeg to exit gracefully...

Version of frigate Output from /api/version 0.8.4-5043040 Config file Include your full config file wrapped in triple back ticks.

mqtt:
  host: 192.168.0.178
  user: <REDACTED>
  password: <REDACTED>
cameras:
  doorbell:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_cuvid
      inputs:
        - path: rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/102
          roles:
            - detect
            - record
        - path: rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/101
          roles:
            - clips
            - rtmp
    width: 384
    height: 512
    fps: 8
    clips:
      enabled: True
      retain:
        default: 0
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 0
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
  cpu3:
    type: cpu
  cpu4:
    type: cpu
objects:
  track:
    - person
    - cat
    - dog
    - frisbee

Frigate container logs See Bug

Frigate stats

{
  "detection_fps": 0.0, 
  "detectors": {
    "cpu1": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 50
    }, 
    "cpu2": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 52
    }, 
    "cpu3": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 54
    }, 
    "cpu4": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 55
    }
  }, 
  "doorbell": {
    "camera_fps": 0.0, 
    "capture_pid": 60, 
    "detection_fps": 0.0, 
    "pid": 59, 
    "process_fps": 0.0, 
    "skipped_fps": 0.0
  }, 
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 66.8, 
        "mount_type": "tmpfs", 
        "total": 67.1, 
        "used": 0.3
      }, 
      "/media/frigate/clips": {
        "free": 1132180731.5, 
        "mount_type": "fuse.mergerfs", 
        "total": 1237410700.9, 
        "used": 104329816.1
      }, 
      "/media/frigate/recordings": {
        "free": 1132180731.5, 
        "mount_type": "fuse.mergerfs", 
        "total": 1237410700.9, 
        "used": 104329816.1
      }, 
      "/tmp/cache": {
        "free": 16797.3, 
        "mount_type": "tmpfs", 
        "total": 16797.6, 
        "used": 0.3
      }
    }, 
    "uptime": 10, 
    "version": "0.8.4-5043040"
  }
}

FFprobe from your camera

When both input streams are enabled

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[rtsp @ 0x555733721bc0] Missing PPS in sprop-parameter-sets, ignoring
[rtsp @ 0x555733721bc0] method SETUP failed: 500 Internal Server Error
rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/102: Server returned 5XX Server Error reply

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[rtsp @ 0x55f039f8dbc0] Missing PPS in sprop-parameter-sets, ignoring
Input #0, rtsp, from 'rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264, yuv420p(progressive), 1536x2048, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

When only sub-stream input enabled

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[rtsp @ 0x562aa3e3dbc0] Missing PPS in sprop-parameter-sets, ignoring
[rtsp @ 0x562aa3e3dbc0] max delay reached. need to consume packet
[rtsp @ 0x562aa3e3dbc0] RTP: missed 1 packets
Input #0, rtsp, from 'rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/102':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264, yuv420p(progressive), 384x512, 8 fps, 8 tbr, 90k tbn, 16 tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

When only main-stream input enabled

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[rtsp @ 0x56495d2a7bc0] Missing PPS in sprop-parameter-sets, ignoring
[rtsp @ 0x56495d2a7bc0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: aac, 16000 Hz, mono, fltp

Screenshots If applicable, add screenshots to help explain your problem.

Computer Hardware

Camera Info:

Additional context Add any other context about the problem here.

blakeblackshear commented 3 years ago

Try using a less aggressive set of input args. Sometimes the defaults are too hard on wifi cameras. If that doesn't work, I would be curious if you have issues when viewing both feeds elsewhere. You may be saturating the wifi bandwidth of the camera. Can you lower the FPS on the main stream?

mqtt:
  host: 192.168.0.178
  user: <REDACTED>
  password: <REDACTED>
cameras:
  doorbell:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_cuvid
      inputs:
        - path: rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/102
          roles:
            - detect
            - record
          input_args:
            - -avoid_negative_ts
            - make_zero
            - -fflags
            - +genpts+discardcorrupt
            - -use_wallclock_as_timestamps
            - '1'
        - path: rtsp://<REDACTED>@192.168.0.26:554/Streaming/Channels/101
          roles:
            - clips
            - rtmp
          input_args:
            - -avoid_negative_ts
            - make_zero
            - -fflags
            - +genpts+discardcorrupt
            - -use_wallclock_as_timestamps
            - '1'
    width: 384
    height: 512
    fps: 8
    clips:
      enabled: True
      retain:
        default: 0
    snapshots:
      enabled: True
      bounding_box: True
      retain:
        default: 0
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
  cpu3:
    type: cpu
  cpu4:
    type: cpu
objects:
  track:
    - person
    - cat
    - dog
    - frisbee
D34DC3N73R commented 3 years ago

I'll try that updated config and lowering the main stream fps. After posting, I did have the same thought about oversaturating the doorbell camera. I wanted to try out Frigate while waiting for the coral USB to show up. Since this was really more of a test, I still have the doorbell cam set up on my NVR. If that updated config doesn't work, I'll try removing it from the NVR and testing again.

D34DC3N73R commented 3 years ago

The input arguments didn't help, but after removing the cam from the NVR, I'm able to run both streams on frigate without issue. 👍