blakeblackshear / frigate

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

[Camera Support]: Nest RTSP Works in VLC. Frigate Go2RTC config return "WRN [streams] can't get track url=..." and "codecs not match: H264,AAC" #5382

Closed gabemcg closed 1 year ago

gabemcg commented 1 year ago

Describe the problem you are having

I've got Nest-RTSP feeds working for my wired 1st gen Nest Doorbell and Kitchen (Nest Hub Max). Both are viewable by entering their respective URL in VLC (rtsp://10.1.10.6:554/Doorbell or rtsp://10.1.10.6:554/kitchen). I have confirmed in VLC that the streams are both using H264 and AAC, but when I add them to the Frigate config file it seems to think they are not H264/AAC. I believe this may have to do with the current config not using UDP for the streams? I have tried adding the following UDP specific FFMPEG Input Args from the documentation to the Go2RTC portion of the Frigate config file, but it causes Frigate to crash on load:

go2rtc: streams: Driveway:

Version

frigate:0.12.0-beta7

Frigate config file

mqtt:
  host: 10.1.10.32
  port: 1883
  user: mqtt-user
  password: "{FRIGATE_MQTT_PASSWORD}"
  stats_interval: 60
detectors:
  coral:
    type: edgetpu
    device: usb
go2rtc:
  streams:
    Driveway:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.22:554/Streaming/Channels/101/
    Driveway_sub:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.22:554/Streaming/Channels/102/
    Front_Porch:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.23:554/Streaming/Channels/101/
    Front_Porch_sub:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.23:554/Streaming/Channels/102/
    West_Side:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.24:554/Streaming/Channels/101/
    West_Side_sub:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.24:554/Streaming/Channels/102/
    Back_Porch:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.25:554/Streaming/Channels/101/
    Back_Porch_sub:
      - rtsp://admin:{FRIGATE_RTSP_PASSWORD}@10.1.10.25:554/Streaming/Channels/102/
    Doorbell:
      - rtsp://10.1.10.6:554/Doorbell
cameras:
  Driveway:
    ui:
      order: 3
    ffmpeg:
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      output_args:
        record: preset-record-generic
      inputs:
        - path: rtsp://127.0.0.1:8554/Driveway_sub?video=copy
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/Driveway?video=copy
          input_args: preset-rtsp-restream
          roles:
            - record
    objects:
      track:
        - person
        - dog
        - cat
        - bicycle
        - car
      filters:
        person:
          threshold: 0.8
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: True
      retain:
        default: 3
    zones:
      driveway:
        coordinates: 245,188,308,6,632,86,704,480,128,479
      front_yard_right:
        coordinates: 309,4,139,480,0,418,0,42,105,18
      side yard:
        coordinates: 704,473,702,112,626,89  
    motion:
      mask:
        - 0,0,704,0,704,107,623,89,498,32,304,26,299,10,135,19,0,40
  Front_Porch:
    ui:
      order: 2
    ffmpeg:
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      output_args:
        record: preset-record-generic
      inputs:
        - path: rtsp://127.0.0.1:8554/Front_Porch_sub?video=copy
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/Front_Porch?video=copy
          input_args: preset-rtsp-restream
          roles:
            - record
    objects:
      track:
        - person
        - dog
        - cat
        - bicycle
      filters:
        person:
          threshold: 0.8
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: True
      retain:
        default: 3
    zones:
      front_yard_left:
        coordinates: 286,378,384,337,588,480,704,480,704,174,598,118,467,70,259,15,258,341
      sidewalk_street:
        coordinates: 704,0,260,0,259,19,454,74,704,172
      front_porch:
        coordinates: 704,480,0,480,2,0,28,5,33,71,172,35,182,0,262,0,260,334,364,295,425,288,591,480,658,480,704,429
    motion:
      mask:
        - 0,83,243,21,366,52,473,73,704,174,704,0,0,0
  West_Side:
    ui:
      order: 5
    ffmpeg:
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      output_args:
        record: preset-record-generic
      inputs:
        - path: rtsp://127.0.0.1:8554/West_Side_sub?video=copy
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/West_Side?video=copy
          input_args: preset-rtsp-restream
          roles:
            - record
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          threshold: 0.8
        cat:
          threshold: 0.81
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: True
      retain:
        default: 3
    zones:
      zone_0:
        coordinates: 0,480,704,480,704,392,312,189,205,107,101,122,74,32,201,0,0,0
    motion:
      mask:
        - 348,32,704,24,704,0,346,0
        - 165,480,299,445,250,352,127,384
        - 584,371,663,332,570,270,496,301
        - 209,101,99,118,88,25,202,0,320,0,324,214
  Back_Porch:
    ui:
      order: 4    
    ffmpeg:
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      output_args:
        record: preset-record-generic
      inputs:
        - path: rtsp://127.0.0.1:8554/Back_Porch_sub?video=copy
          roles:
            - detect
        - path: rtsp://127.0.0.1:8554/Back_Porch?video=copy
          input_args: preset-rtsp-restream
          roles:
            - record
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          threshold: 0.7
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: True
      retain:
        default: 3
    zones:
      East_Side:
        coordinates: 55,0,108,318,0,421,0,39,41,0
      Back_Door:
        coordinates: 474,0,453,125,336,132,344,0
      Back_Deck:
        coordinates: 280,396,398,480,621,398,659,340,681,190,595,110,468,109,299,127,222,223
    motion:
      mask:
        - 348,28,704,28,704,0,350,0
        - 704,0,634,0,633,55,663,92,704,95
        - 284,0,283,79,115,99,112,0
        - 505,0,617,0,603,81,496,74
  Doorbell:
    ui:
      order: 1    
    ffmpeg:
      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/Doorbell?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          threshold: 0.7
    snapshots:
      enabled: True
      timestamp: false
      bounding_box: True
      retain:
        default: 3
birdseye:
  enabled: True
  width: 1920
  height: 1080
  quality: 1
  mode: continuous
detect:
  width: 704
  height: 480
  fps: 6
record:
  enabled: True
  retain:
    days: 1
    mode: all
#restream:
#  enabled: True

Relevant log output

Frigate Log output (without UDP config added)

2023-02-04 12:24:09.751989972  12:24:09.751 WRN [streams] can't get track url=rtsp://10.1.10.6:554/Doorbell
2023-02-04 12:24:09.792969889  12:24:09.792 WRN [streams] can't get track url=rtsp://10.1.10.6:554/Doorbell
2023-02-04 12:24:09.793071800  12:24:09.793 WRN [rtsp] error="codecs not match: H264,AAC" stream=Doorbell
2023-02-04 12:24:09.794768031  [2023-02-04 12:24:09] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.
2023-02-04 12:24:09.794844876  [2023-02-04 12:24:09] frigate.video                  ERROR   : Doorbell: ffmpeg process is not running. exiting capture thread...
2023-02-04 12:24:19.666021367  [2023-02-04 12:24:19] watchdog.Doorbell              ERROR   : Ffmpeg process crashed unexpectedly for Doorbell.
2023-02-04 12:24:19.666079703  [2023-02-04 12:24:19] watchdog.Doorbell              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-02-04 12:24:19.666089989  [2023-02-04 12:24:19] ffmpeg.Doorbell.detect         ERROR   : [rtsp @ 0x55fee4257080] method DESCRIBE failed: 404 Not Found
2023-02-04 12:24:19.666154000  [2023-02-04 12:24:19] ffmpeg.Doorbell.detect         ERROR   : rtsp://127.0.0.1:8554/Doorbell?video=copy&audio=aac: Server returned 404 Not Found

Go2RTC Log Output:

2023-02-04 12:12:57.309767371  12:12:57.309 INF go2rtc version 1.1.1 linux/amd64
2023-02-04 12:12:57.309908201  12:12:57.309 INF [api] listen addr=:1984
2023-02-04 12:12:57.310106819  12:12:57.310 INF [rtsp] listen addr=:8554
2023-02-04 12:12:57.310381885  12:12:57.310 INF [srtp] listen addr=:8443
2023-02-04 12:12:57.310534052  12:12:57.310 INF [webrtc] listen addr=:8555
2023-02-04 12:12:59.193982488  12:12:59.193 WRN [streams] can't get track url=rtsp://10.1.10.6:554/Doorbell
2023-02-04 12:12:59.235050953  12:12:59.234 WRN [streams] can't get track url=rtsp://10.1.10.6:554/Doorbell
2023-02-04 12:12:59.235108676  12:12:59.235 WRN [rtsp] error="codecs not match: H264,AAC" stream=Doorbell

FFprobe output from your camera

# ffprobe rtsp://10.1.10.6:554/Doorbell
ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, rtsp, from 'rtsp://10.1.10.6:554/Doorbell':
  Metadata:
    title           : SDM
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1600x1200 [SAR 1:1 DAR 4:3], 15 fps, 15 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp

Frigate stats

No response

Operating system

UNRAID

Install method

Docker CLI

Coral version

USB

Network connection

Wired

Camera make and model

Gen1 Nest Wired Doorbell

Any other information that may be helpful

No response

gabemcg commented 1 year ago

these are the logs I get from Frigate when it won't load with the FFMPEG Input Args added

s6-rc: info: service legacy-services successfully started Traceback (most recent call last): File "/usr/local/go2rtc/create_config.py", line 73, in go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS) AttributeError: 'dict' object has no attribute 'format' Service go2rtc exited with code 1 (by signal 0) s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service nginx: stopping Service NGINX exited with code 0 (by signal 0) s6-rc: info: service nginx successfully stopped s6-rc: info: service nginx-log: stopping s6-rc: info: service frigate: stopping s6-rc: info: service nginx-log successfully stopped Service Frigate exited with code 256 (by signal 15) s6-rc: info: service frigate successfully stopped s6-rc: info: service go2rtc: stopping s6-rc: info: service frigate-log: stopping s6-rc: info: service go2rtc successfully stopped s6-rc: info: service go2rtc-log: stopping s6-rc: info: service frigate-log successfully stopped s6-rc: info: service go2rtc-log successfully stopped s6-rc: info: service log-prepare: stopping s6-rc: info: service s6rc-fdholder: stopping s6-rc: info: service log-prepare successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service s6rc-fdholder successfully stopped s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped

NickM-27 commented 1 year ago

Show your config when trying to set the udp. Seems it's being done incorrectly

gabemcg commented 1 year ago

Show your config when trying to set the udp. Seems it's being done incorrectly

Only change from posted config is below: edit- not sure how to get formatting in this reply to match the actual config file, but I believe I have the correct indentations in the actual file

go2rtc: streams: Driveway:

NickM-27 commented 1 year ago

Yeah that's incorrect. Ffmpeg is not a list item. I'd recommend reading the go2rtc docs on how to format that

NickM-27 commented 1 year ago

It would look like this

go2rtc:
  ffmpeg:
    rtsp: "-fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport udp -i {input}"
  streams:
    ...
gabemcg commented 1 year ago

It would look like this

go2rtc:
  ffmpeg:
    rtsp: "-fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport udp -i {input}"
  streams:
    ...

Thanks, with that change it no longer crashes frigate, but still getting the same codec match errors:

2023-02-04 16:12:35.118017351 16:12:35.117 WRN [streams] can't get track url=rtsp://10.1.10.6:554/Doorbell 2023-02-04 16:12:35.118034261 16:12:35.118 WRN [rtsp] error="codecs not match: H264,AAC" stream=Doorbell

NickM-27 commented 1 year ago

In that case I'd recommend making an issue on go2rtc

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.