blakeblackshear / frigate

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

[Support]: Clip for event sometimes starts 20 seconds after timestamp on snapshot #7239

Closed ratsputin closed 1 year ago

ratsputin commented 1 year ago

Describe the problem you are having

I'm trying to track down an issue where the video clip associated with an event starts ~20 seconds after the actual event. This isn't consistent and is difficult to identify, as it is only an issue when a detection occurs near the edge of a the camera image.

For example, a camera is facing the street and someone is walking. Say the detection takes place 10 seconds before they leave the frame. The snapshot tied to the event will show the person at the time of the detection, let's say at 07:00:00. Now, the person leaves the frame at 07:00:10. The issue I'm running into is the clip associated with the event only starts at 07:00:20 and runs until 07:01:20, completely missing the actual event.

Version

0.12.1-AB50D0B

Frigate config file

detectors:
  tensorrt:
    type: tensorrt
    device: 0 #This is the default, select the first GPU

model:
  path: /trt-models/yolov7-640-DLA0.trt
  input_tensor: nchw
  input_pixel_format: rgb
  width: 640
  height: 640

mqtt:
  host: ha.dante.local

birdseye:
  enabled: true
  mode: motion
  width: 2560
  height: 1440

ffmpeg:
  hwaccel_args: -hwaccel_output_format yuv420p -c:v h264_nvmpi

logger:
  default: info

cameras:

#
# Front yard overview camera
#
  front-yard:
    ffmpeg:
      inputs:
        - path: http://192.168.1.206/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1920
      fps: 5
    motion:
      mask:
        - 826,78,1697,76,1697,0,828,0
        - 0,554,658,509,1211,514,1820,542,2560,623,2560,0,0,0
    objects:
      filters:
        car:
          mask:
            - 0,554,692,507,1284,514,1874,555,2560,611,2560,0,0,0
          min_area: 50000
        person:
          min_area: 5000
      track:
        - person
        - dog
        - cat
        - car
        - motorcycle
        - bicycle
    zones:
      yard:
        coordinates: 0,1920,2560,1920,2560,805,1682,747,976,722,0,726
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5 

#
# Back Yard overview camera
#
  back-yard:
    ffmpeg:
      inputs:
        - path: http://192.168.1.205/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1920
      fps: 1
    motion:
      mask:
        - 826,78,1697,76,1697,0,828,0
        - 1023,0,1041,205,1086,355,1319,337,1532,236,1621,388,1853,464,1891,845,2560,1059,2560,0,1592,0
        - 431,371,340,450,360,508,451,516,568,535,640,583,769,748,959,798,1292,793,1522,701,1697,550,1676,426,1502,330,1043,243,675,283
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          min_area: 5000
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

#
# Front Door (portico) camera
#
  front-door:
    ffmpeg:
      inputs:
        - path: http://192.168.1.204/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1920
      fps: 5
    motion:
      mask:
        - 826,78,1697,76,1697,0,828,0
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          min_area: 10000
          threshold: .85
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

#
# Carport camera
#
  carport:
    ffmpeg:
      inputs:
        - path: http://192.168.1.201/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1440
      fps: 5
    motion:
      mask:
        - 836,81,1694,76,1686,0,833,0
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          min_area: 100000
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

#
# Master bathroom door camera
#
  master-bath:
    ffmpeg:
      inputs:
        - path: http://192.168.1.202/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1920
      fps: 1
    motion:
      mask:
        - 826,78,1697,76,1697,0,828,0
        - 2162,177,2069,648,2560,863,2560,0,1990,0
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          min_area: 10000
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

#
# Drive Gate camera
#
  drive-gate:
    ffmpeg:
      inputs:
        - path: http://192.168.1.203/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1440
      fps: 5
    motion:
      mask:
        - 836,81,1694,76,1686,0,833,0
        - 0,1440,537,1440,1054,939,950,549,1544,35,2031,30,2560,35,2560,0,0,0
        - 2380,514,2292,1440,2560,1440,2560,0,2337,0
    objects:
      track:
        - person
        - dog
        - cat
        - car
      filters:
        person:
          min_area: 10000
          threshold: .85
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

#
# Side yard (by A/C units) camera
#
  side-yard:
    ffmpeg:
      inputs:
        - path: http://192.168.1.207/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=
          input_args: preset-http-reolink
          roles:
            - record
            - detect
    rtmp:
      enabled: false
    detect:
      width: 2560
      height: 1440
      fps: 5
    motion:
      mask:
        - 836,81,1694,76,1686,0,833,0
        - 1697,1440,2560,1440,2560,0,1810,0
        - 1370,626,1663,636,1664,451,1395,440
        - 921,1332,1378,1440,1487,1040,1069,970
        - 0,1440,623,461,1125,458,1279,241,1261,0,0,0
    objects:
      filters:
        person:
          min_area: 5000
      track:
        - person
        - dog
        - cat
    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      retain:
        default: 5
    record:
      enabled: True
      events:
        retain:
          default: 5

Relevant log output

N/A

FFprobe output from your camera

root@adbd52df397f:/opt/frigate# ffprobe "http://192.168.1.205/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password="
nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
ffprobe version 3f345eb-20220731 Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --disable-debug --disable-libfdk-aac --disable-schannel --enable-avisynth --enable-cuda-llvm --enable-ffnvcodec --enable-fontconfig --enable-frei0r --enable-gmp --enable-gpl --enable-iconv --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libjxl --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-librubberband --enable-libshaderc --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-lv2 --enable-lzma --enable-mbedtls --enable-nvmpi --enable-sdl2 --enable-version3 --enable-vulkan --enable-zlib --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldexeflags=-pie --extra-ldflags=-pthread --extra-libs='-ldl -lgomp' --extra-version=20220731 --pkg-config-flags=--static --pkg-config=pkg-config --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --prefix=/opt/ffmpeg
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, flv, from 'http://192.168.1.205/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=':
  Metadata:
    displayWidth    : 2560
    displayHeight   : 1920
  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 2560x1920, 28 fps, 30 tbr, 1k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Frigate stats

{"back-yard":{"camera_fps":1.1,"capture_pid":480,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":495,"pid":463,"process_fps":1.1,"skipped_fps":0.0},"bandwidth_usages":{"479":{"bandwidth":517.5},"493":{"bandwidth":495.6},"495":{"bandwidth":551.0},"506":{"bandwidth":468.1},"509":{"bandwidth":761.3},"512":{"bandwidth":570.5},"529":{"bandwidth":621.3}},"carport":{"camera_fps":5.6,"capture_pid":487,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":506,"pid":466,"process_fps":5.6,"skipped_fps":0.0},"cpu_usages":{"1":{"cmdline":"/package/admin/s6/command/s6-svscan -d4 -- /run/service","cpu":"0.0","cpu_average":"0","mem":"0.0"},"27":{"cmdline":"s6-supervise s6-linux-init-shutdownd","cpu":"0.0","cpu_average":"0","mem":"0.0"},"29":{"cmdline":"/package/admin/s6-linux-init/command/s6-linux-init-shutdownd -c /run/s6/basedir -g 3000 -C -B","cpu":"0.0","cpu_average":"0","mem":"0.0"},"36":{"cmdline":"s6-supervise frigate-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"37":{"cmdline":"s6-supervise nginx","cpu":"0.0","cpu_average":"0","mem":"0.0"},"38":{"cmdline":"s6-supervise go2rtc-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"39":{"cmdline":"s6-supervise go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"40":{"cmdline":"s6-supervise s6rc-fdholder","cpu":"0.0","cpu_average":"0","mem":"0.0"},"41":{"cmdline":"s6-supervise s6rc-oneshot-runner","cpu":"0.0","cpu_average":"0","mem":"0.0"},"42":{"cmdline":"s6-supervise frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"43":{"cmdline":"s6-supervise nginx-log","cpu":"0.0","cpu_average":"0","mem":"0.0"},"44":{"cmdline":"s6-supervise go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"53":{"cmdline":"/package/admin/s6-2.11.3.0/command/s6-fdholderd -1 -i data/rules","cpu":"0.0","cpu_average":"0","mem":"0.0"},"54":{"cmdline":"/package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/admin/s6/command/s6-sudod -t 30000 -- /package/admin/s6-rc/command/s6-rc-oneshot-run -l ../.. --","cpu":"0.0","cpu_average":"0","mem":"0.0"},"92":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/nginx","cpu":"0.0","cpu_average":"0","mem":"0.0"},"93":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/go2rtc","cpu":"0.0","cpu_average":"0","mem":"0.0"},"94":{"cmdline":"s6-log -b -- T 1 n0 s10000000 T /dev/shm/logs/frigate","cpu":"0.0","cpu_average":"0","mem":"0.0"},"101":{"cmdline":"/usr/local/go2rtc/bin/go2rtc -config=/dev/shm/go2rtc.yaml","cpu":"0.0","cpu_average":"0","mem":"0.1"},"109":{"cmdline":"bash ./run.user go2rtc-healthcheck","cpu":"0.0","cpu_average":"0","mem":"0.0"},"110":{"cmdline":"python3 -u -m frigate","cpu":"8.3","cpu_average":"3","mem":"5.0"},"122":{"cmdline":"nginx: master process nginx","cpu":"0.0","cpu_average":"0","mem":"0.1"},"152":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"153":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"154":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"155":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.2"},"159":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"169":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.3"},"187":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"218":{"cmdline":"nginx: worker process","cpu":"0.0","cpu_average":"0","mem":"0.1"},"443":{"cmdline":"frigate.logger       ","cpu":"0.0","cpu_average":"0","mem":"1.0"},"445":{"cmdline":"frigate.recording_manager","cpu":"2.5","cpu_average":"2","mem":"1.5"},"454":{"cmdline":"/usr/bin/python3 -c from multiprocessing.resource_tracker import main;main(50)","cpu":"0.5","cpu_average":"0","mem":"0.1"},"455":{"cmdline":"frigate.detector.tensorrt","cpu":"0.0","cpu_average":"24","mem":"14.1"},"458":{"cmdline":"frigate.output       ","cpu":"7.1","cpu_average":"6","mem":"1.3"},"461":{"cmdline":"frigate.process:front-yard","cpu":"1.4","cpu_average":"1","mem":"1.6"},"462":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1920 -i pipe: -f mpegts -s 960x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"463":{"cmdline":"frigate.process:back-yard","cpu":"0.2","cpu_average":"0","mem":"1.6"},"464":{"cmdline":"frigate.process:front-door","cpu":"1.1","cpu_average":"1","mem":"1.6"},"465":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1920 -i pipe: -f mpegts -s 960x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"466":{"cmdline":"frigate.process:carport","cpu":"1.4","cpu_average":"1","mem":"1.6"},"467":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1920 -i pipe: -f mpegts -s 960x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"468":{"cmdline":"frigate.process:master-bath","cpu":"0.2","cpu_average":"0","mem":"1.6"},"470":{"cmdline":"frigate.process:drive-gate","cpu":"1.1","cpu_average":"1","mem":"1.6"},"471":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1440 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"473":{"cmdline":"frigate.process:side-yard","cpu":"1.4","cpu_average":"1","mem":"1.5"},"474":{"cmdline":"frigate.capture:front-yard","cpu":"7.1","cpu_average":"7","mem":"1.4"},"475":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1920 -i pipe: -f mpegts -s 960x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"479":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.206/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/front-yard-%Y%m%d%H%M%S.mp4 -r 5 -s 2560x1920 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"19.8","cpu_average":"16","mem":"1.3"},"480":{"cmdline":"frigate.capture:back-yard","cpu":"1.1","cpu_average":"1","mem":"1.3"},"482":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1440 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"483":{"cmdline":"frigate.capture:front-door","cpu":"7.6","cpu_average":"7","mem":"1.3"},"487":{"cmdline":"frigate.capture:carport","cpu":"6.4","cpu_average":"5","mem":"1.3"},"491":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1440 -i pipe: -f mpegts -s 1280x720 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"492":{"cmdline":"frigate.capture:master-bath","cpu":"1.4","cpu_average":"1","mem":"1.3"},"493":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.204/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/front-door-%Y%m%d%H%M%S.mp4 -r 5 -s 2560x1920 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"19.1","cpu_average":"20","mem":"1.3"},"495":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.205/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/back-yard-%Y%m%d%H%M%S.mp4 -r 1 -s 2560x1920 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"17.5","cpu_average":"13","mem":"1.1"},"499":{"cmdline":"frigate.capture:drive-gate","cpu":"7.4","cpu_average":"5","mem":"1.3"},"502":{"cmdline":"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 2560x1440 -i pipe: -f mpegts -s 2560x1440 -codec:v mpeg1video -q 8 -bf 0 pipe:","cpu":"0.0","cpu_average":"0","mem":"0.3"},"505":{"cmdline":"frigate.capture:side-yard","cpu":"5.3","cpu_average":"5","mem":"1.3"},"506":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.201/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/carport-%Y%m%d%H%M%S.mp4 -r 5 -s 2560x1440 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"16.5","cpu_average":"13","mem":"1.0"},"509":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.203/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/drive-gate-%Y%m%d%H%M%S.mp4 -r 5 -s 2560x1440 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"17.0","cpu_average":"13","mem":"1.0"},"512":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.202/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/master-bath-%Y%m%d%H%M%S.mp4 -r 1 -s 2560x1920 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"17.0","cpu_average":"13","mem":"1.1"},"529":{"cmdline":"ffmpeg -hide_banner -loglevel warning -threads 2 -hwaccel_output_format yuv420p -c:v h264_nvmpi -user_agent FFmpeg Frigate/0.12.1-ab50d0b -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000 -i http://192.168.1.207/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password= -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/side-yard-%Y%m%d%H%M%S.mp4 -r 5 -s 2560x1440 -threads 2 -f rawvideo -pix_fmt yuv420p pipe:","cpu":"14.7","cpu_average":"14","mem":"1.2"},"297469":{"cmdline":"sleep 30s","cpu":"0.0","cpu_average":"0","mem":"0.0"}},"detection_fps":0.0,"detectors":{"tensorrt":{"detection_start":0.0,"inference_speed":243.48,"pid":455}},"drive-gate":{"camera_fps":5.0,"capture_pid":499,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":509,"pid":470,"process_fps":5.0,"skipped_fps":0.0},"front-door":{"camera_fps":5.0,"capture_pid":483,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":493,"pid":464,"process_fps":5.0,"skipped_fps":0.0},"front-yard":{"camera_fps":5.0,"capture_pid":474,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":479,"pid":461,"process_fps":5.0,"skipped_fps":0.0},"master-bath":{"camera_fps":1.0,"capture_pid":492,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":512,"pid":468,"process_fps":1.0,"skipped_fps":0.0},"processes":{"go2rtc":{"pid":101},"logger":{"pid":443},"recording":{"pid":445}},"service":{"last_updated":1689898957,"latest_version":"0.12.1","storage":{"/dev/shm":{"free":477.5,"mount_type":"tmpfs","total":536.9,"used":59.3},"/media/frigate/clips":{"free":790858.3,"mount_type":"ext4","total":983228.2,"used":151786.5},"/media/frigate/recordings":{"free":790858.3,"mount_type":"ext4","total":983228.2,"used":151786.5},"/tmp/cache":{"free":983.4,"mount_type":"tmpfs","total":1073.7,"used":90.4}},"temperatures":{},"uptime":172883,"version":"0.12.1-ab50d0b"},"side-yard":{"camera_fps":5.0,"capture_pid":505,"detection_enabled":1,"detection_fps":0.0,"ffmpeg_pid":529,"pid":473,"process_fps":5.0,"skipped_fps":0.0}}

Operating system

Other Linux

Install method

Docker Compose

Coral version

Other

Network connection

Wired

Camera make and model

Reolink RLC-410

Any other information that may be helpful

Note, this is on my port of Frigate and its supporting tools to the NVIDIA Jetson Orin NX (aarch64 with NVIDIA GPU acceleration). I'm just trying to track down whether this is a known issue and what the cause might be or if it's something I've introduced somehow.

The fact that detections and recordings seem to be in sync the majority of the time (~90%+) leads me to believe everything is working properly and there are circumstances that trigger this.

I've also noticed that there are random instances where I get an error that the clip is entirely missing for an event.

Can you offer any insight into what might be happening and where I might look?

NickM-27 commented 1 year ago

Given that the recordings are ahead of the snapshot, the only explanation I can think of is that the detect feed is behind the recording feed.

Usually this would be due to differences in the streams but given that both are using a single stream it would seem likely that the decoder is what is introducing the delay.

The variability of it adds to this, meaning the decoder is usually fine but can sometimes get behind.

ratsputin commented 1 year ago

Ah! That's what I was looking for. Thank you.

Unfortunately, the Jetson's jtop utility only provides the clock speed of the NVDEC, not its activity level. I've noticed it's pegged at 857MHz continually and wondered if that might be a problem.

The Jetson is an impressive little platform. The fact that it can (mostly) keep up with decoding and performing motion detection across seven high-res camera feeds for just 25W power draw and leverage the yolov7-640 model for detections says a lot.

Once again, thank you for the assistance.

ratsputin commented 1 year ago

That was exactly the issue. I checked the cameras with a direct connection vs. through Frigate and the video was lagging by 20+ seconds. I reduced the framerate on the cameras from 30fps to 20fps across seven total cameras and it is now keeping up. Thank you again for the help.