blakeblackshear / frigate

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

ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures #941

Closed disdi closed 3 years ago

disdi commented 3 years ago

Describe the bug Unable to capture camera frames via ffmpeg on RPI 3B . On the webserver green color appears instead of actual camera frame

Version of frigate 0.8.4-5043040

Config file Include your full config file wrapped in triple back ticks.

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
          roles:
            - detect
            - rtmp
    width: 1280
    height: 720
    fps: 5
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu

Frigate container logs

pi@raspberrypi:~ $ docker run  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 --device /dev/bus/usb:/dev/bus/usb  -v /home/pi/fri/media:/media/frigate -v /home/pi/fri/config.yml:/config/config.yml   -v /etc/localtime:/etc/localtime:ro  -e FRIGATE_RTSP_PASSWORD='password' -p 5000:5000 -p 1935:1935 blakeblackshear/frigate:stable-armv7
 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
detector.cpu1                  INFO    : Starting detection process: 32
frigate.mqtt                   INFO    : MQTT connected
frigate.app                    INFO    : Camera processor started for back: 36
detector.cpu2                  INFO    : Starting detection process: 34
frigate.app                    INFO    : Capture process started for back: 38
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [tcp @ 0x16f47e0] Connection to tcp://10.0.10.10:554?timeout=5000000 failed: Connection timed out
ffmpeg.back.detect             ERROR   : rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2: Connection timed out
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [tcp @ 0xd317e0] Connection to tcp://10.0.10.10:554?timeout=5000000 failed: Connection timed out
ffmpeg.back.detect             ERROR   : rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2: Connection timed out
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [tcp @ 0x11277e0] Connection to tcp://10.0.10.10:554?timeout=5000000 failed: Connection timed out
ffmpeg.back.detect             ERROR   : rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2: Connection timed out
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [tcp @ 0x251f7e0] Connection to tcp://10.0.10.10:554?timeout=5000000 failed: Connection timed out
ffmpeg.back.detect             ERROR   : rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2: Connection timed out
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [tcp @ 0x14de7e0] Connection to tcp://10.0.10.10:554?timeout=5000000 failed: Connection timed out
ffmpeg.back.detect             ERROR   : rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2: Connection timed out

Frigate stats

{
  "back": {
    "camera_fps": 0.0, 
    "capture_pid": 38, 
    "detection_fps": 0.0, 
    "pid": 36, 
    "process_fps": 0.0, 
    "skipped_fps": 0.0
  }, 
  "detection_fps": 0.0, 
  "detectors": {
    "cpu1": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 32
    }, 
    "cpu2": {
      "detection_start": 0.0, 
      "inference_speed": 10.0, 
      "pid": 34
    }
  }, 
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 66.8, 
        "mount_type": "tmpfs", 
        "total": 67.1, 
        "used": 0.3
      }, 
      "/media/frigate/clips": {
        "free": 24680.7, 
        "mount_type": "ext4", 
        "total": 31083.6, 
        "used": 5104.4
      }, 
      "/media/frigate/recordings": {
        "free": 24680.7, 
        "mount_type": "ext4", 
        "total": 31083.6, 
        "used": 5104.4
      }, 
      "/tmp/cache": {
        "free": 1000.0, 
        "mount_type": "tmpfs", 
        "total": 1000.0, 
        "used": 0.0
      }
    }, 
    "uptime": 374, 
    "version": "0.8.4-5043040"
  }
}

FFprobe from your camera

Run the following command and paste output below

pi@raspberrypi:~ $ ffprobe rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
pi@raspberrypi: ~$ ffprobe version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  WARNING: library configuration mismatch
  avutil      configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avcodec     configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avformat    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avdevice    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avfilter    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  avresample  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swscale     configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  swresample  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  postproc    configuration: --prefix=/usr --extra-version='1~deb10u1+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
tcp @ 0x19889b0] Connection to tcp://10.0.10.10:554?timeout=0 failed: Connection timed out
rtsp://viewer:password@10.0.10.10:554/cam/realmonitor?channel=1: Connection timed out

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

Computer Hardware

Camera Info:

blakeblackshear commented 3 years ago

Width and height in your config don't match your camera resolution.

disdi commented 3 years ago

Changed settings to match camera resolution as mentioned in Picamera documentation . Updated Config file

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
          roles:
            - detect
            - rtmp
    width: 3280
    height: 2464
    fps: 15
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
ffmpeg:
  hwaccel_args:
    - -c:v
    - h264_mmal
logger:
  default: debug
  logs:
    frigate.video: debug

I am still getting the same error .

blakeblackshear commented 3 years ago

Remove your hwaccel args. If that works, then you don't have enough gpu_mem set for the Pi. You will need to increase it in config.txt, but it can only go so high. It may not go high enough for that high of a resolution.

disdi commented 3 years ago

Update the config to remove hwaccel args as shown below.

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
          roles:
            - detect
            - rtmp
    width: 3280
    height: 2464
    fps: 15
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
logger:
  default: debug

I still get the same error. I also tried minimum resolution of 640x480 at 60fps as shown in below config -

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
          roles:
            - detect
            - rtmp
    width: 640
    height: 480
    fps: 60
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
logger:
  default: debug

Still the problem persists.

blakeblackshear commented 3 years ago

Is the rtsp url in the error message actually the right url for your camera? It seems like it's the default from the example config. It's trying to connect to your camera and failing.

disdi commented 3 years ago

I am using my RPI Camera(ip 192.168.0.23) both as a source and sink for network stream.

In 1st terminal , I start streaming out via raspivid -

pi@raspberrypi:~ $ raspivid -o - -t 0 -rot 180 -w 1920 -h 1080 -fps 30 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/cam/realmonitor}' :demux=h264

In 2nd terminal I start frigate via docker command -

pi@raspberrypi:~ $ docker run  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 --device /dev/bus/usb:/dev/bus/usb  -v /home/pi/fri/media:/media/frigate -v /home/pi/fri/config.yml:/config/config.yml:ro   -v /etc/localtime:/etc/localtime:ro  -e FRIGATE_RTSP_PASSWORD='password' -p 5000:5000 -p 1935:1935 blakeblackshear/frigate:stable-armv7

Thanks for pointing it out for letting me check my rtsp url in my config file. Somehow I forgot to update it and copy/pasted the one from example config The updated config looks like one below -

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.0.23:8554/cam/realmonitor
          roles:
            - detect
            - rtmp
    width: 1920
    height: 1080
    fps: 30
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
logger:
  default: debug

However ffmpeg somehow still complains of broken frame. Further I now start getting error also for rtsp

 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
detector.cpu1                  INFO    : Starting detection process: 32
detector.cpu2                  INFO    : Starting detection process: 34
frigate.app                    INFO    : Camera processor started for back: 37
frigate.app                    INFO    : Capture process started for back: 38
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [rtsp @ 0x19734e0] method SETUP failed: 461 Unsupported transport
ffmpeg.back.detect             ERROR   : rtsp://192.168.0.23:8554/cam/realmonitor: Protocol not supported
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [rtsp @ 0x1c844e0] method SETUP failed: 461 Unsupported transport
ffmpeg.back.detect             ERROR   : rtsp://192.168.0.23:8554/cam/realmonitor: Protocol not supported
frigate.video                  INFO    : back: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : back: ffmpeg process is not running. exiting capture thread...
ffmpeg.back.detect             ERROR   : [rtsp @ 0x11844e0] method SETUP failed: 461 Unsupported transport
ffmpeg.back.detect             ERROR   : rtsp://192.168.0.23:8554/cam/realmonitor: Protocol not supported

However I test with a test rtsp stream available online as shown below,

mqtt:
  host: test.mosquitto.org
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream
          roles:
            - detect
            - rtmp
    width: 1920
    height: 1080
    fps: 30
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
logger:
  default: debug

I don´t get the error -

pi@raspberrypi:~ $ docker run --security-opt seccomp:unconfined  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 --device /dev/bus/usb:/dev/bus/usb  -v /home/pi/fri/media:/media/frigate -v /home/pi/fri/config.yml:/config/config.yml   -v /etc/localtime:/etc/localtime:ro  -e FRIGATE_RTSP_PASSWORD='password' -p 5000:5000 -p 1935:1935 blakeblackshear/frigate:stable-armv7 
 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
detector.cpu1                  INFO    : Starting detection process: 33
detector.cpu2                  INFO    : Starting detection process: 35
frigate.app                    INFO    : Camera processor started for back: 38
frigate.app                    INFO    : Capture process started for back: 39
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
peewee                         DEBUG   : ('SELECT DISTINCT "t1"."label" FROM "event" AS "t1" WHERE ("t1"."camera" NOT IN (?))', ['back'])
peewee                         DEBUG   : ('SELECT DISTINCT "t1"."label" FROM "event" AS "t1" WHERE ("t1"."camera" = ?)', ['back'])
peewee                         DEBUG   : ('SELECT DISTINCT "t1"."label" FROM "event" AS "t1" WHERE ("t1"."camera" NOT IN (?))', ['back'])
peewee                         DEBUG   : ('SELECT DISTINCT "t1"."label" FROM "event" AS "t1" WHERE ("t1"."camera" = ?)', ['back'])
peewee.sqliteq                 DEBUG   : received query with grouped_events as (
          select id,
            label, 
            camera, 
            has_snapshot,
            has_clip,
            row_number() over (
              partition by label, camera, round(start_time/5,0)*5
              order by end_time-start_time desc
            ) as copy_number
          from event
        )

        select distinct id, camera, has_snapshot, has_clip from grouped_events 
        where copy_number > 1;
peewee                         DEBUG   : ('with grouped_events as (\n          select id,\n            label, \n            camera, \n          \thas_snapshot,\n          \thas_clip,\n          \trow_number() over (\n              partition by label, camera, round(start_time/5,0)*5\n              order by end_time-start_time desc\n            ) as copy_number\n          from event\n        )\n\n        select distinct id, camera, has_snapshot, has_clip from grouped_events \n        where copy_number > 1;', [])
peewee.sqliteq                 DEBUG   : received query DELETE FROM "event" WHERE (0 = 1)
peewee                         DEBUG   : ('DELETE FROM "event" WHERE (0 = 1)', [])
peewee.sqliteq                 DEBUG   : received query DELETE FROM "event" WHERE (("event"."has_clip" = ?) AND ("event"."has_snapshot" = ?))
peewee                         DEBUG   : ('DELETE FROM "event" WHERE (("event"."has_clip" = ?) AND ("event"."has_snapshot" = ?))', [False, False])
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.

Stats also do not report anything wrong -

{
  "back": {
    "camera_fps": 13.2, 
    "capture_pid": 39, 
    "detection_fps": 1.0, 
    "pid": 38, 
    "process_fps": 0.3, 
    "skipped_fps": 0.0
  }, 
  "detection_fps": 1.0, 
  "detectors": {
    "cpu1": {
      "detection_start": 0.0, 
      "inference_speed": 838.38, 
      "pid": 33
    }, 
    "cpu2": {
      "detection_start": 0.0, 
      "inference_speed": 851.16, 
      "pid": 35
    }
  }, 
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 54.1, 
        "mount_type": "tmpfs", 
        "total": 67.1, 
        "used": 13.0
      }, 
      "/media/frigate/clips": {
        "free": 24133.3, 
        "mount_type": "ext4", 
        "total": 31083.6, 
        "used": 5651.8
      }, 
      "/media/frigate/recordings": {
        "free": 24133.3, 
        "mount_type": "ext4", 
        "total": 31083.6, 
        "used": 5651.8
      }, 
      "/tmp/cache": {
        "free": 1000.0, 
        "mount_type": "tmpfs", 
        "total": 1000.0, 
        "used": 0.0
      }
    }, 
    "uptime": 502, 
    "version": "0.8.4-5043040"
  }
}

Maybe there is something wrong with my Raspi Cam V2 in the way I using it as a RTSP server.

kbmetz commented 3 years ago

raspivid and vlc won't work. I tried it numerous times and never got it to see an image. I'm still trying to find something that will run on a raspberry pi and stream something that frigate will recognize

stale[bot] commented 3 years 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.

jdesai61 commented 3 years ago

I tried using rpi camera with v4l2rtspserver and it seems to work fine. I am using frigate on jetson nano with PCI coral card.

kbmetz commented 3 years ago

I tried using rpi camera with v4l2rtspserver and it seems to work fine. I am using frigate on jetson nano with PCI coral card.

Can you show me the settings you used to run?

jdesai61 commented 3 years ago

On RPI 3

/usr/local/bin/v4l2rtspserver -F 5 -W 1280 -H 960

on jetson nano where frigate is running:


cameras:
  rpicam1:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.118:8554/unicast
          roles:
            - detect
            - rtmp
            - record
    width: 1280
    height: 960
    fps: 5
kbmetz commented 3 years ago

On RPI 3

/usr/local/bin/v4l2rtspserver -F 5 -W 1280 -H 960

on jetson nano where frigate is running:


cameras:
  rpicam1:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.118:8554/unicast
          roles:
            - detect
            - rtmp
            - record
    width: 1280
    height: 960
    fps: 5

Thank you!!! I finally got this working!

KillahB33 commented 3 years ago

@jdesai61 do you have hwaccell on? would you mind posting your config, I am struggling with my jetson nano.

jdesai61 commented 3 years ago

@jdesai61 do you have hwaccell on? would you mind posting your config, I am struggling with my jetson nano.

Here is my frigate config (I did not do anything explicit to turn hardware config on). What are the issues you are having?:

ffmpeg:
  global_args: -loglevel info

cameras:
  rpicam1:
    ffmpeg:
      inputs:
        - path: rtsp://user:pass@192.168.1.25:8554/unicast
          roles:
            - clips
            - detect
            - rtmp
            - record
    width: 1280
    height: 960
    fps: 5
KillahB33 commented 3 years ago

Ah ok, I am trying to get h264_nvmpi to work and though you were using it. My cpus are maxing out so I need to figure out how to get this working.

jdesai61 commented 3 years ago

My cpus are maxing out so I need to figure out how to get this working.

I am using Coral TPU (non-USB M.2 E) on the Nano

Details here: https://community.home-assistant.io/t/local-realtime-person-detection-for-rtsp-cameras/103107/4347

KillahB33 commented 3 years ago

Ok so you are in the same situation as I am as it doesn't appear you have setup hwaccel. I have coral, my cpus are maxing out cause of the video encoding/decoding.

jdesai61 commented 3 years ago

I have coral, my cpus are maxing out cause of the video encoding/decoding.

Coral won't help with encoding or decoding. But you should not need encoding.

KillahB33 commented 3 years ago

Coral won't help with encoding or decoding. But you should not need encoding.

I'm a total noob when it comes to this so I said both. Yeah need to get hw encoding going, I created an issue we shall see how it goes.

pushpinder107 commented 2 years ago

Try using the Home Assistant Add-on: Frigate NVR (Full Access) supervisor addon if you want to use hardware acceleration.

LordNex commented 2 years ago

I tried using rpi camera with v4l2rtspserver and it seems to work fine. I am using frigate on jetson nano with PCI coral card.

@jdesai61 Do you happen to have an amazon link to the TPU you bought for the Nano that worked? I have the 4 gig and i thought its slot was already filled with the GPU daughter card.

jdesai61 commented 2 years ago

I tried using rpi camera with v4l2rtspserver and it seems to work fine. I am using frigate on jetson nano with PCI coral card.

@jdesai61 Do you happen to have an amazon link to the TPU you bought for the Nano that worked? I have the 4 gig and i thought its slot was already filled with the GPU daughter card.

I did not order from Amazon. I ordered three items from seeedstudio.com. The one I used with Nano is first one (SKU 102110449)

Coral M.2 Accelerator with Dual Edge TPU - SKU: 102110449 Coral M.2 Accelerator A+E key - SKU: 114992123 Coral USB Accelerator - SKU: 114991790

LordNex commented 2 years ago

https://github.com/jdesai61

So your use all 3 of those devices? Can I ask your usage scenario? Personally I have Frigate doing basic person detection which sends the capture through MQTT to DeepStack and Double Take. But I’m using it for person and facial recognition DeepStack is running on the Nano, Double Take running as a Home Assistant add on with an i5 laptop, and Frigate running on an ESXi 7 server With 12 cores and 32 gigs of ram.

On Dec 29, 2021, at 1:16 PM, Jatin Desai @.***> wrote:



I tried using rpi camera with v4l2rtspserver and it seems to work fine. I am using frigate on jetson nano with PCI coral card.

@jdesai61https://github.com/jdesai61 Do you happen to have an amazon link to the TPU you bought for the Nano that worked? I have the 4 gig and i thought its slot was already filled with the GPU daughter card.

I did not order from Amazon. I ordered three items from seeedstudio.com. The one I used with Nano is first one (SKU 102110449)

Coral M.2 Accelerator with Dual Edge TPU - SKU: 102110449 Coral M.2 Accelerator A+E key - SKU: 114992123 Coral USB Accelerator - SKU: 114991790

— Reply to this email directly, view it on GitHubhttps://github.com/blakeblackshear/frigate/issues/941#issuecomment-1002741672, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACGXNJEERPDFKL5VR2BVHPTUTNNANANCNFSM4Z47UCLA. You are receiving this because you commented.Message ID: @.***>

jdesai61 commented 2 years ago

I only use one Coral device (m2 dual edge) with frigate and six IP cameras. Other two coral devices are for experimental purposes.

LordNex commented 2 years ago

I was wondering where those extra TPUs were. I just got my hands on one the other day and put it on a RPi4 8gig. Only issue I currently have is that I’m getting an error if i try and install aarch64 or even the beta of the aarch64. So I’m basically running it under an arm7 kernel inside a 64 but docker container. I’m hoping that @blakeblackshear will eventually be able to put out a stable precompiled version. I’ve read some how to’s on ways you can compile your own version but I really don’t want to have to fork off and maintain my own copy.

Either way it’s working tons better now. So more cameras are going in. Currently have 5 streams recording full time to a NAS and then sends. The Frigate on the Pi4 with the TPU does the initial object recognition and then passes the info along to MQTT to DeepStack in the Nano and Hone Assistant on a different box. All in all it works very well seeing as 4 of the streams are wireless. I already have another doorbell camera and a few new ReoLink PoE cameras ready to install. All in all it was probably more expensive than buying a prebuilt Security Camera system. But this taught me a lot more and I’m not vendor locked nor paying subscription fees. Expect to Home Assistant just because I want to support them.

Blake also said that it’s possible to use multiple detectors, they just can’t be of the same type yet. But I could see a kubernets Pi cluster each with a TPU being pretty dam powerful for about the same price as a single server with less cores and ram.

On Jan 4, 2022, at 3:11 PM, Jatin Desai @.***> wrote:



I only use one Coral device (m2 dual edge) with frigate and six IP cameras. Other two coral devices are for experimental purposes.

— Reply to this email directly, view it on GitHubhttps://github.com/blakeblackshear/frigate/issues/941#issuecomment-1005173524, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACGXNJACQ5GNFEHEB74QU63UUNPBFANCNFSM4Z47UCLA. You are receiving this because you commented.Message ID: @.***>