Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
disdi opened this issue Mar 27, 2021 · 25 comments
Labels

Comments

@disdi
Copy link

disdi commented Mar 27, 2021

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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]:554/cam/realmonitor?channel=1: Connection timed out


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

Computer Hardware

  • OS: [Ubuntu 20.04]
  • Install method: [Docker Command]
  • Virtualization: [None]
  • Coral Version: [None]
  • Network Setup: [Wired]

Camera Info:

  • Manufacturer: Raspberry Pi , 8MP
  • Model: V2.1
  • Resolution: 1080p
  • FPS: [5]
@blakeblackshear
Copy link
Owner

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

@disdi
Copy link
Author

disdi commented Mar 27, 2021

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
Copy link
Owner

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
Copy link
Author

disdi commented Mar 27, 2021

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
Copy link
Owner

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
Copy link
Author

disdi commented Mar 27, 2021

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
Copy link

kbmetz commented Apr 9, 2021

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

@cpainchaud cpainchaud mentioned this issue Apr 13, 2021
@stale
Copy link

stale bot commented May 9, 2021

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.

@stale stale bot added the stale label May 9, 2021
@stale stale bot closed this as completed May 12, 2021
@jdesai61
Copy link

jdesai61 commented May 12, 2021

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
Copy link

kbmetz commented May 12, 2021

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
Copy link

jdesai61 commented May 12, 2021

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
Copy link

kbmetz commented May 13, 2021

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
Copy link

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

@jdesai61
Copy link

jdesai61 commented Jun 4, 2021

@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:[email protected]:8554/unicast
          roles:
            - clips
            - detect
            - rtmp
            - record
    width: 1280
    height: 960
    fps: 5

@KillahB33
Copy link

KillahB33 commented Jun 4, 2021

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
Copy link

jdesai61 commented Jun 4, 2021

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
Copy link

KillahB33 commented Jun 4, 2021

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
Copy link

jdesai61 commented Jun 4, 2021

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
Copy link

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
Copy link

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

@LordNex
Copy link

LordNex commented Dec 29, 2021

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
Copy link

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
Copy link

LordNex commented Dec 29, 2021 via email

@jdesai61
Copy link

jdesai61 commented Jan 4, 2022

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

@LordNex
Copy link

LordNex commented Jan 5, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants