blakeblackshear / frigate

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

[Support]: Live and Recording Video "Artifacting" #3803

Closed esmoyer closed 2 years ago

esmoyer commented 2 years ago

Describe the problem you are having

Since moving to RC2, my cameras will randomly "artifact" from time to time. I think I followed all the changes needed with the change from RC1 to RC2 (RC1 had zero issues). No settings have been changed for Frigate or the cameras (except variable changes needed by RC2). I did notice I previously had 'vaapi' uncommented, but with RC2 my system didn't like it and would causes errors, so not sure if that is part of it.

image

image

Version

0.11.0-c461c9e (RC2)

Frigate config file

mqtt:
  host: X.X.X.X
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: X
  password: X

detectors:
  coral:
    type: edgetpu
    device: usb

database:
  path: /media/frigate/db/frigate.db

logger:
  default: info
  # logs:
    # frigate.event: debug

birdseye:
  enabled: true
  width: 1280
  height: 720
  quality: 15  # 1 is the highest quality, and 31 is the lowest.
  mode: motion

ui:
  use_experimental: true

cameras:
########## CAMERAS
#################### DRIVEWAY
  Driveway:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
            - rtmp
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      #input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
      output_args:
        record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy #-an
        rtmp: -c copy -f flv

    detect:
      enabled: true 
      max_disappeared: 30
      width: 2592
      height: 1944
      fps: 5
      stationary:
        interval: 0
        threshold: 50
        # max_frames:
          # default: 3000

    objects: 
      track:
        - person
        - car
        - dog
      filters:
        person:
          min_area: 4000
          max_area: 600000
          min_score: 0.68
          threshold: 0.74
          # mask:
            # - 22,328,107,324,118,292,21,305
        dog:
          min_area: 4500
          max_area: 80000
          min_score: 0.60
          threshold: 0.65
        car:
          min_area: 20000
          max_area: 600000
          min_score: 0.67
          threshold: 0.73
          mask:
            - 225,190,80,322,338,264,524,146,438,58,258,118
            - 1176,144,1208,220,1647,259,1499,66,1351,41,1230,31
            - 2399,440,2592,524,2499,430,2440,335,2263,286

    motion:
      threshold: 25
      improve_contrast: false
      mask:
        - 1654,0,1920,0,2570,0,2426,351,1866,262,1274,0
        - 2592,1944,2592,1540,2368,1550,2112,1570,2148,1944
        - 157,157,228,105,390,0,0,0,0,361

    record:
      enabled: true
      retain:
        days: 21
        mode: all
      events:
        #max_seconds: 600
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
          - car
        retain:
          default: 21
          objects:
            car: 7

    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      crop: false 
      retain:
        default: 21

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

    zones:  
      zone_driveway:
        coordinates: 1038,1875,2414,1862,2592,1364,2532,1212,2287,934,2054,713,1696,681,1100,655

      zone_front_lawn:
        coordinates: 985,647,732,639,410,662,0,708,0,1318,409,1402,893,1466

      # zone_front_sidewalk:
        # coordinates: 0,505,311,471,943,466,1466,515,1827,568,1815,533,1462,459,868,422,603,422,252,449,0,485

      zone_street:
        coordinates: 310,345,34,424,30,524,493,448,1143,438,1980,525,2514,658,2548,570,2251,463,1806,360,1151,297,839,300,565,320

################### DOORBELL
  Doorbell:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      output_args:
        record: 
          -f segment 
          -segment_time 10 
          -segment_format mp4 
          -reset_timestamps 1 
          -strftime 1 
          -c copy 
          #-an

    detect:
      enabled: true
      max_disappeared: 30
      width: 2560
      height: 1920
      fps: 5

    objects:
      track:
        - person
        - dog
      filters:
        person:
          min_area: 2500
          max_area: 600000
          min_score: 0.67
          threshold: 0.74
          mask:
            - 2512,1279,2518,1774,2092,1680,2304,1359,2392,1247
            - 2197,1224,2299,1210,2290,1078,2199,1085
        dog:
          min_area: 2000
          max_area: 100000
          min_score: 0.65
          threshold: 0.70

    motion:
      threshold: 25
      improve_contrast: true
      mask:
        - 830,950,654,1024,325,967,0,1013,0,0,520,0,858,0,1341,0,2560,0,2479,889,2490,1006,1309,914
        - 2281,1920,2443,1278,2302,1381,1786,1503,1657,1638,1664,1833,1700,1920
        - 779,1541,728,1299,487,1231,412,1519

    record:
      enabled: true
      retain:
        days: 14
      events:
        #max_seconds: 300
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
        retain:
          default: 14

    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      crop: false
      retain:
        default: 14

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

    zones:  
      zone_front_porch:
        coordinates: 858,1529,613,1615,561,1675,363,1669,41,1920,636,1920,2237,1920,1996,1577,1662,1618,1590,1814,1455,1825,1370,1721,1176,1694,1205,1557

      # zone_front_sidewalk:
        # coordinates: 281,1205,758,1273,1023,1296,1366,1305,1879,1276,2267,1230,2197,1217,2029,1241,1636,1271,1197,1271,852,1253,664,1236,459,1208,288,1179

      zone_driveway:
        coordinates: 2319,1481,2421,1315,2223,1286,1841,1331

      zone_front_lawn:
        coordinates: 1722,1330,1278,1339,843,1322,358,1250,159,1270,199,1314,39,1549,268,1584,342,1351,840,1503,1154,1527,1351,1554,1467,1463,1605,1465,1674,1559,2181,1498

################### SIDEDRIVE
  Sidedrive:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      # input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
      output_args:
        record: 
          -f segment 
          -segment_time 10 
          -segment_format mp4 
          -reset_timestamps 1 
          -strftime 1 
          -c copy 
          #-an

    detect:
      enabled: true
      max_disappeared: 30
      width: 2592
      height: 1944
      fps: 5

    objects: # Optional: Camera level object filters config.
      track:
        - person
        - dog
      filters:
        person:
          min_area: 4500
          max_area: 600000
          min_score: 0.7
          threshold: 0.74
        dog:
          min_area: 2000
          max_area: 90000
          min_score: 0.65
          threshold: 0.70

    motion:
      threshold: 25
      improve_contrast: true
      mask:
        - 2592,0,2592,84,1578,64,1578,0
        - 0,650,248,466,657,190,640,0,0,0

    record:
      enabled: true
      retain:
        days: 10
      events:
        #max_seconds: 300
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
        retain:
          default: 10

    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      crop: false
      retain:
        default: 10

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

################### SIDEYARD
  Sideyard:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      # input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
      output_args:
        record: 
          -f segment 
          -segment_time 10 
          -segment_format mp4 
          -reset_timestamps 1 
          -strftime 1 
          -c copy 
          #-an

    detect:
      enabled: true
      max_disappeared: 30
      width: 2048
      height: 1536
      fps: 5

    objects:
      track:
        - person
        - dog
        # - car
      filters:
        person:
          min_area: 5000
          max_area: 150000
          min_score: 0.7
          threshold: 0.74
        dog:
          min_area: 250
          max_area: 25000
          min_score: 0.63
          threshold: 0.67
          # mask:
            # - 873,123,957,349,968,606,648,466,240,181,286,0
        car:
          min_area: 5000
          max_area: 150000
          min_score: 0.64
          threshold: 0.68
          # mask:
            # - 41,783,546,878,896,842,885,772,86,639
            # - 550,456,970,603,1045,371,970,255,855,122,296,27,227,182

    motion:
      threshold: 25
      improve_contrast: true
      mask:
        - 315,354,366,650,1709,614,1629,471,1506,357,1208,0,815,394
        - 615,1536,1209,1339,1524,1155,1841,959,1749,886,1417,1046,1175,1140,550,1331
        - 2048,0,2048,524,1960,337,1694,110,1665,0

    record:
      enabled: true
      retain:
        days: 10
        mode: all
      events:
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
          - car
        retain:
          default: 10

    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true 
      crop: false
      retain:
        default: 10

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

################### BACKYARD
  Backyard:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      # input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
      output_args:
        record: 
          -f segment 
          -segment_time 10 
          -segment_format mp4 
          -reset_timestamps 1 
          -strftime 1 
          -c copy 
          #-an

    detect:
      enabled: true
      max_disappeared: 30
      width: 2592
      height: 1944
      fps: 5

    objects: # Optional: Camera level object filters config.
      track:
        - person
        - dog
      filters:
        person:
          min_area: 10000
          max_area: 700000
          min_score: 0.74
          threshold: 0.77
        dog:
          min_area: 3500
          max_area: 75000
          min_score: 0.65
          threshold: 0.72

    motion:
      threshold: 30 #lower higher sensitivity; higher lower sensitivity
      improve_contrast: true
      mask:
        - 1801,0,1801,99,1724,291,1916,378,2149,440,2292,438,2286,296,2400,300,2464,499,2592,542,2592,0,1920,0
        - 1404,0,1075,102,820,135,532,115,384,158,216,148,89,171,0,204,0,0,287,0

    record:
      enabled: true
      retain:
        days: 14
      events:
        #max_seconds: 600
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
        retain:
          default: 14

    snapshots:
      enabled: true
      timestamp: true 
      bounding_box: true
      crop: false
      retain:
        default: 14

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

    zones:
      zone_backyard:
        coordinates: 43,1913,486,1883,836,1246,1445,791,2343,770,2570,698,2144,417,1895,333,1742,327,1520,299,1277,302,1143,250,896,268,736,289,545,392,420,532,56,1184

################### GARAGE
  Garage:
    ffmpeg:
      inputs:
        - path: rtsp://X:X@X.X.X.X
          roles:
            - detect
            - record
      global_args: 
        -hide_banner 
        -loglevel error
      hwaccel_args: 
        # - -hwaccel
        # - vaapi
        - -hwaccel_device
        - /dev/dri/renderD128
        - -hwaccel_output_format
        - yuv420p
      # input_args: -avoid_negative_ts make_zero -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1
      output_args:
        record: 
          -f segment 
          -segment_time 10 
          -segment_format mp4 
          -reset_timestamps 1 
          -strftime 1 
          -c copy 
          #-an

    detect:
      enabled: true
      max_disappeared: 30
      width: 1280
      height: 960
      fps: 5

    objects:
      track:
        - person
        - dog
      filters:
        person:
          min_area: 5000
          max_area: 450000
          min_score: 0.70
          threshold: 0.74
        dog:
          min_area: 4700
          max_area: 50000
          min_score: 0.60
          threshold: 0.70
          # mask:
            # - 1435,148,1876,285,1684,731,1316,422

    motion:
      threshold: 40
      improve_contrast: false
      mask:
        - 160,85,649,77,892,85,1280,44,1280,0,0,0,0,146

    record:
      enabled: true
      retain:
        days: 0
      events:
        #max_seconds: 300
        pre_capture: 5
        post_capture: 5
        objects:
          - person
          - dog
        retain:
          default: 7

    snapshots:
      enabled: true
      timestamp: true
      bounding_box: true
      crop: false
      retain:
        default: 7

    rtmp:
      enabled: false

    timestamp_style:
      position: "bl"
      thickness: 2

    best_image_timeout: 30

Relevant log output

Have tried to catch something, but nothing shows in logs when it happens

FFprobe output from your camera

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://X:X@X.X.X.X':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.104000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2048x1536, 20 fps, 100 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Frigate stats

{"Backyard":{"camera_fps":5.0,"capture_pid":247,"detection_fps":10.8,"pid":233,"process_fps":5.0,"skipped_fps":0.0},"Doorbell":{"camera_fps":5.1,"capture_pid":237,"detection_fps":3.9,"pid":228,"process_fps":5.1,"skipped_fps":0.0},"Driveway":{"camera_fps":5.0,"capture_pid":236,"detection_fps":0.0,"pid":225,"process_fps":5.0,"skipped_fps":0.0},"Garage":{"camera_fps":5.0,"capture_pid":251,"detection_fps":0.0,"pid":235,"process_fps":5.0,"skipped_fps":0.0},"Sidedrive":{"camera_fps":5.1,"capture_pid":239,"detection_fps":5.1,"pid":229,"process_fps":5.1,"skipped_fps":0.0},"Sideyard":{"camera_fps":5.0,"capture_pid":242,"detection_fps":0.0,"pid":231,"process_fps":5.0,"skipped_fps":0.0},"detection_fps":19.8,"detectors":{"coral":{"detection_start":0.0,"inference_speed":10.41,"pid":217}},"service":{"latest_version":"0.10.1","storage":{"/dev/shm":{"free":1034.3,"mount_type":"tmpfs","total":1073.7,"used":39.4},"/media/frigate/clips":{"free":667239.2,"mount_type":"ext4","total":3936819.7,"used":3069524.4},"/media/frigate/recordings":{"free":667239.2,"mount_type":"ext4","total":3936819.7,"used":3069524.4},"/tmp/cache":{"free":969.6,"mount_type":"tmpfs","total":1000.0,"used":30.4}},"temperatures":{},"uptime":45,"version":"0.11.0-c461c9e"}}

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

IP5M-T1179EW

Any other information that may be helpful

No response

NickM-27 commented 2 years ago

You definitely need vaapi otherwise I don't think it will use hwaccel, in any case that isn't the args that are recommended in the docs. Probably put that back in and paste the logs here.

NickM-27 commented 2 years ago

also what CPU do you have again?

esmoyer commented 2 years ago

Thanks for the quick response. Yeah I had been trying different things suggested from previous issues. I'll uncomment the vaapi and post logs. I have an Intel Gen6 i5.

NickM-27 commented 2 years ago

Okay cool, please also include your docker compose file

esmoyer commented 2 years ago

Enabled vaapi here are the logs:

[2022-09-09 10:32:36] frigate.app                    INFO    : Starting Frigate (0.11.0-c461c9e)

Starting migrations

[2022-09-09 10:32:36] peewee_migrate                 INFO    : Starting migrations

There is nothing to migrate

[2022-09-09 10:32:36] peewee_migrate                 INFO    : There is nothing to migrate

[2022-09-09 10:32:36] detector.coral                 INFO    : Starting detection process: 217

[2022-09-09 10:32:36] frigate.app                    INFO    : Output process started: 219

[2022-09-09 10:32:36] ws4py                          INFO    : Using epoll

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Driveway: 225

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Doorbell: 228

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Sidedrive: 229

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Sideyard: 231

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Backyard: 233

[2022-09-09 10:32:36] frigate.app                    INFO    : Camera processor started for Garage: 235

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Driveway: 236

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Doorbell: 237

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Sidedrive: 239

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Sideyard: 242

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Backyard: 247

[2022-09-09 10:32:36] frigate.app                    INFO    : Capture process started for Garage: 251

[2022-09-09 10:32:37] ws4py                          INFO    : Using epoll

[2022-09-09 10:32:36] frigate.edgetpu                INFO    : Attempting to load TPU as usb

[2022-09-09 10:32:39] frigate.edgetpu                INFO    : TPU found

[2022-09-09 10:58:46] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:53912]

[2022-09-09 11:00:22] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:53912]

[cont-finish.d] executing container finish scripts...

[cont-finish.d] done.

[s6-finish] waiting for services.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] done.

[services.d] starting services

[services.d] done.

[2022-09-09 11:00:27] frigate.app                    INFO    : Starting Frigate (0.11.0-c461c9e)

Starting migrations

[2022-09-09 11:00:27] peewee_migrate                 INFO    : Starting migrations

There is nothing to migrate

[2022-09-09 11:00:27] peewee_migrate                 INFO    : There is nothing to migrate

[2022-09-09 11:00:28] frigate.app                    INFO    : Output process started: 218

[2022-09-09 11:00:28] ws4py                          INFO    : Using epoll

[2022-09-09 11:00:28] detector.coral                 INFO    : Starting detection process: 216

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Driveway: 221

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:28] frigate.edgetpu                INFO    : Attempting to load TPU as usb

[2022-09-09 11:00:31] frigate.edgetpu                INFO    : TPU found

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Doorbell: 225

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Sidedrive: 229

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Backyard: ffmpeg process is not running. exiting capture thread...

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Sideyard: 231

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Backyard: 232

[2022-09-09 11:00:31] frigate.video                  ERROR   : Driveway: ffmpeg process is not running. exiting capture thread...

[2022-09-09 11:00:28] frigate.app                    INFO    : Camera processor started for Garage: 234

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Driveway: 235

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Doorbell: 239

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Sidedrive: 242

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Sideyard: 245

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Backyard: 252

[2022-09-09 11:00:28] frigate.app                    INFO    : Capture process started for Garage: 256

[2022-09-09 11:00:29] ws4py                          INFO    : Using epoll

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:31] frigate.video                  ERROR   : Doorbell: ffmpeg process is not running. exiting capture thread...

[2022-09-09 11:00:34] frigate.record                 ERROR   : Error occurred when attempting to maintain recording cache

[2022-09-09 11:00:34] frigate.record                 ERROR   : could not convert string to float: ''

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sideyard: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sideyard: ffmpeg process is not running. exiting capture thread...

[2022-09-09 11:00:39] frigate.record                 ERROR   : Error occurred when attempting to maintain recording cache

[2022-09-09 11:00:39] frigate.record                 ERROR   : could not convert string to float: ''

[2022-09-09 11:00:39] frigate.video                  ERROR   : Garage: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Garage: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Garage: ffmpeg process is not running. exiting capture thread...

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sidedrive: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sidedrive: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sidedrive: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sidedrive: Unable to read frames from ffmpeg process.

[2022-09-09 11:00:39] frigate.video                  ERROR   : Sidedrive: ffmpeg process is not running. exiting capture thread...

Docker Compose

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:0.11.0-rc2
    shm_size: "256mb" # update for your cameras based on calculation above
    devices:
      - /dev/bus/usb:/dev/bus/usb # passes the USB Coral, needs to be modified for other versions
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /mnt/camstorage/frigate/config:/config:ro
      - /mnt/camstorage/frigate/recordings:/media/frigate/recordings
      - /mnt/camstorage/frigate/clips:/media/frigate/clips
      - /mnt/camstorage/frigate/db:/media/frigate/db
      - /dev/bus/usb:/dev/bus/usb
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "X"
      TZ: "American/Chicago"
      LIBVA_DRIVER_NAME: "i965"
NickM-27 commented 2 years ago

Hmm, that is very odd. If you run vainfo in the container what do you see?

esmoyer commented 2 years ago
root@ee023d7e2238:/opt/frigate# vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.10.0
libva info: User environment variable requested driver 'i965'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.10 (libva 2.10.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointStats
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointStats
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointStats
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
root@ee023d7e2238:/opt/frigate# 
NickM-27 commented 2 years ago

That's very weird then that VAAPI isn't happy for some reason. What happens if you try

ffmpeg:
  hwaccel_args: -c:v h264_qsv
NickM-27 commented 2 years ago

Also with your setup you posted at the beginning, did you verify that the intel gpu was actually being utilized?

esmoyer commented 2 years ago

That's very weird then that VAAPI isn't happy for some reason. What happens if you try

ffmpeg:
  hwaccel_args: -c:v h264_qsv

No errors using this! Not sure about the artifacting yet as I'll have to watch it a bit. That is so weird; so can you ELI5? I'm clueless when it comes to video stuff.

[2022-09-09 16:21:48] frigate.app                    INFO    : Starting Frigate (0.11.0-c461c9e)

Starting migrations

[2022-09-09 16:21:48] peewee_migrate                 INFO    : Starting migrations

There is nothing to migrate

[2022-09-09 16:21:48] peewee_migrate                 INFO    : There is nothing to migrate

[2022-09-09 16:21:49] detector.coral                 INFO    : Starting detection process: 216

[2022-09-09 16:21:49] frigate.app                    INFO    : Output process started: 218

[2022-09-09 16:21:49] ws4py                          INFO    : Using epoll

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Driveway: 224

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Doorbell: 227

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Sidedrive: 229

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Sideyard: 231

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Backyard: 232

[2022-09-09 16:21:49] frigate.app                    INFO    : Camera processor started for Garage: 233

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Driveway: 235

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Doorbell: 236

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Sidedrive: 240

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Sideyard: 244

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Backyard: 247

[2022-09-09 16:21:49] frigate.app                    INFO    : Capture process started for Garage: 251

[2022-09-09 16:21:49] ws4py                          INFO    : Using epoll

[2022-09-09 16:21:50] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:34948]

[2022-09-09 16:21:49] frigate.edgetpu                INFO    : Attempting to load TPU as usb

[2022-09-09 16:21:51] frigate.edgetpu                INFO    : TPU found

[2022-09-09 16:22:00] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:34948]

[2022-09-09 16:22:00] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:58262]
esmoyer commented 2 years ago

Also with your hwaccel recommendation, this is my intel_gpu_top; if that helps with anything

image

NickM-27 commented 2 years ago

No errors using this! Not sure about the artifacting yet as I'll have to watch it a bit. That is so weird; so can you ELI5? I'm clueless when it comes to video stuff.

VAAPI is the standard linux GPU api. QSV (quick sync video) is an intel specific standard that is built on top of VAAPI. The reason for No frames you were getting with vaapi is unknown, could be any number of things including a bug in the driver on the host or some other issue. Plenty of other users have used it without issue though so it does seem to be something system specific (presumably also including the way this ffmpeg build we are using now is built / includes drivers).

Also with your hwaccel recommendation, this is my intel_gpu_top; if that helps with anything

image

In any case, this shows that it is being utilized which is what we want to see. Hopefully the smearing issue you saw are gone as well.

esmoyer commented 2 years ago

Awesome, really appreciate the help. I can usually fumble my way through things to fix or get it working but this had me stumped.

foureight84 commented 2 years ago

I'm currently on an Intel J5005 (Ubuntu 22.04 server minimized install) and I've noticed that when I use:

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p

I get artifacts similar to that of the screenshot in the original post but not as bad. However, when looking at intel_gpu_top, both Reder/3D and Video engines are utilized with Render/3D hitting about 7-9% while Video stays below 4%.

When switching to:

ffmpeg:
  hwaccel_args:
    - -c:v
    - h264_qsv

intel_gpu_top shows 9-10% usage on the Video engine but the artifacts are worst and exactly as the first photo posted.

I've also noticed that vainfo is not available in the 0.11.1 container.

NickM-27 commented 2 years ago

I'm currently on an Intel J5005 (Ubuntu 22.04 server minimized install) and I've noticed that when I use:


ffmpeg:

  hwaccel_args:

    - -hwaccel

    - vaapi

    - -hwaccel_device

    - /dev/dri/renderD128

    - -hwaccel_output_format

    - yuv420p

I get artifacts similar to that of the screenshot in the original post but not as bad. However, when looking at intel_gpu_top, both Reder/3D and Video engines are utilized with Render/3D hitting about 7-9% while Video stays below 4%.

When switching to:


ffmpeg:

  hwaccel_args:

    - -c:v

    - h264_qsv

intel_gpu_top shows 9-10% usage on the Video engine but the artifacts are worst and exactly as the first photo posted.

What cameras do you have? Are you using the recommended stream type/ args?

I've also noticed that vainfo is not available in the 0.11.1 container.

You can simply use apt-get to install vainfo in the container.

foureight84 commented 2 years ago

What cameras do you have? Are you using the recommended stream type/ args?

I am currently using the Wyze Cam V3 with the wz_mini_hacks running on top of the camera. I think I see what's causing the issue for me. I've just split the inputs to use low res (640x360) for detection while high res (1920x1080) for recording. When I view the live feed there are no artifacts anymore but the recording still has the artifacts. So it looks like resolution (along with other settings) might be the culprit?

Using the low res stream for detection has also decreased GPU usage significantly. Intel_gpu_top shows only 1-2% utilization on the video engine.

I believe that I am using the recommended stream type and arguments. But here's my config in case I missed something:

mqtt:
  host: 192.168.x.x
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  stats_interval: 60

detectors:
  coral:
    type: edgetpu
    device: pci

database:
  path: /media/frigate/frigate.db

model:
  path: /config/models/spaghettinet/spaghettinet_edgetpu_l_compiled.tflite
  width: 320
  height: 320

logger:
  default: info
  logs:
    frigate.event: debug

birdseye:
  enabled: True
  width: 1280
  height: 720
  quality: 8
  mode: objects

ffmpeg:
  global_args: -hide_banner -loglevel warning
  hwaccel_args:
    - -c:v
    - h264_qsv
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  output_args:
    detect: -f rawvideo -pix_fmt yuv420p
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac
    rtmp: -c copy -f flv

detect:
  width: 640
  height: 360
  fps: 5
  enabled: True
  max_disappeared: 50
  stationary:
    interval: 10
    threshold: 100

objects:
  track:
    - person
    - dog
    - cat
    - mouse
  filters:
    person:
      min_area: 4000
      max_area: 24000000
      min_score: 0.5
      threshold: 0.7
    cat:
      min_score: 0.5
      threshold: 0.8
    dog:
      min_score: 0.5
      threshold: 0.8

motion:
  threshold: 25
  contour_area: 99
  delta_alpha: 0.2
  frame_alpha: 0.2
  frame_height: 180
  improve_contrast: False
  mqtt_off_delay: 30

record:
  enabled: True
  expire_interval: 60
  retain:
    days: 152
    mode: all
  events:
    pre_capture: 5
    post_capture: 5
    objects:
      - person
      - dog
      - cat
      - mouse
    required_zones: []
    retain:
      default: 152
      mode: motion
      objects:
        person: 152
        dog: 152
        cat: 152
        mouse: 152

snapshots:
  enabled: True
  clean_copy: True
  timestamp: False
  bounding_box: False
  crop: False
  height: 175
  required_zones: []
  retain:
    default: 152
    objects:
      person: 152
      dog: 152
      cat: 152
      mouse: 152

rtmp:
  enabled: True

live:
  height: 720
  quality: 8

timestamp_style:
  position: "tl"
  format: "%m/%d/%Y %H:%M:%S"
  color:
    red: 255
    green: 255
    blue: 255
  thickness: 2

cameras:
  3411_porch:
    zones:
      front_yard:
        coordinates: 0,360,0,196,21,180,168,162,304,152,315,145,398,144,422,144,502,142,640,139,640,360
        objects:
          - person
          - dog
          - cat
          - mouse
      doorsteps:
        coordinates: 72,360,330,299,475,265,490,211,640,164,640,360
        objects:
          - person
    record:
      events:
        required_zones:
          - front_yard
          - doorsteps
    snapshots:
      required_zones:
        - front_yard
        - doorsteps
    ffmpeg:
      inputs:
        - path: rtsp://x:x@192.168.x.x:8554/video1_unicast
          roles:
            - record
        - path: rtsp://x:x@192.168.x.x:8554/video2_unicast
          roles:
            - detect
            - rtmp
    best_image_timeout: 60

    mqtt:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: True
      height: 270
      quality: 70
      required_zones: []

    ui:
      order: 0
      dashboard: True
foureight84 commented 1 year ago

I want to follow up on this artifact issue. At least for me it has gone away after switching to using the Docker Wyze Bridge container to expose the RTSP rather than using the Wyze Mini Hacks that run on top of the camera's firmware. Most likely, the issue, at least for me, was caused by the custom firmware addon. It could be a number of things like the patched camera process or CPU utilization issues leading to stream errors.