Local realtime person detection for RTSP cameras

The new models are for image classification not object detection, so the predictions don’t include bounding boxes.

I think I have fixed the issue with the Wyzecam feed locally. I had to move several things around, so I need to handle several new edge cases and do more testing. Should be coming in a 0.5.1-rc2 release. Not sure if I will finish today before we leave for spring break.

1 Like

sounds great. Hope you are going somewhere without crowds! Enjoy the time away.

I was looking more closely at the graphs and was wondering how the coral and detection FPS rates can be higher than the camera streaming rate.

Check the last sentence of this post: Local realtime person detection for RTSP cameras

1 Like

Just pushed up a 0.5.1-rc2 image which has been stable with my Wyzecam for 6 hours.

I’ve updated to 0.5.1-rc2 and it errored out after about 5 minutes with the following

2020-03-14T20:58:45.122512222Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T20:58:45.123234455Z driveway: ffmpeg process is not running. exiting capture thread...
2020-03-14T20:58:49.519964145Z Creating ffmpeg process...
2020-03-14T20:58:49.520608592Z ffmpeg -hide_banner -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -vsync drop -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://user:[email protected]/live -f rawvideo -pix_fmt rgb24 pipe:

What are the recommended settings for the ffmpeg process and the config?
Here’s what I currently have

ffmpeg -hide_banner -loglevel panic -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -vsync drop -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://g6ev8v43:[email protected]/live -f rawvideo -pix_fmt rgb24 pipe:
web_port: 5000
mqtt:
  host: 10.0.0.20
  topic_prefix: frigate
objects:
  track:
    - person
    - car
    - truck
  filters:
    person:
      min_area: 5000
      max_area: 100000
      threshold: 0.5
    car:
      min_area: 5000
      max_area: 100000
      threshold: 0.5
cameras:
  driveway:
    ffmpeg:
      input: rtsp://user:[email protected]/live
    width: 1920
    height: 1080
    take_frame: 1
    fps: 5
    snapshots:
      show_timestamp: True
    objects:
      track:
        - person
        - car
      filters:
        person:
          min_area: 5000
          max_area: 100000
          threshold: 0.5

Those settings should be fine. It should have started back up within 10 seconds. Did it not? The failure rate can depend on the quality of your wifi network too.

It does resume, but it keeps dying and restarting.
the wifi signal of the camera is 71% and the stream seems fine in vlcplayer

Here’s a cycle of the last 2 restarts

[h264 @ 0x564f68bc0b00] left block unavailable for requested intra mode33272.3kbits/s speed=0.861x    33272.3kbits/s speed=0.855x
2020-03-14T23:49:55.446216448Z [h264 @ 0x564f68bc0b00] error while decoding MB 0 52, bytestream 635
frame=  196 fps=2.7 q=-0.0 Lsize= 1190700kB time=00:00:13.06 bitrate=746496.0kbits/s speed=0.177x     33272.3kbits/s speed=0.861x
2020-03-14T23:50:00.571418299Z video:1190700kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
2020-03-14T23:50:00.581780271Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:50:00.582318964Z driveway: ffmpeg process is not running. exiting capture thread...
2020-03-14T23:50:05.161053972Z Creating ffmpeg process...
2020-03-14T23:50:05.162030589Z ffmpeg -loglevel info -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -vsync drop -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://user:[email protected]/live -f rawvideo -pix_fmt rgb24 pipe:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers/s speed=0.862x    33272.3kbits/s speed=0.861x
2020-03-14T23:50:05.327286969Z   built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
2020-03-14T23:50:05.327366038Z   configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
2020-03-14T23:50:05.327975817Z   libavutil      55. 78.100 / 55. 78.100
2020-03-14T23:50:05.328167677Z   libavcodec     57.107.100 / 57.107.100
[rtsp @ 0x55d069a76740] DTS discontinuity in stream 1: packet 5 with DTS 12673838453252, packet 6 with DTS 12673838457797d=0.862x
2020-03-14T23:50:07.527094151Z Guessed Channel Layout for Input Stream #0.1 : mono
2020-03-14T23:50:07.527250375Z Input #0, rtsp, from 'rtsp://user:[email protected]/live':
Output #0, rawvideo, to 'pipe:':      0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    =1433272.3kbits/s speed=0.863x
2020-03-14T23:50:07.987884148Z   Metadata:
2020-03-14T23:50:07.988633387Z     Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080, q=2-31, 746496 kb/s, 15 fps, 15 tbn, 15 tbc
2020-03-14T23:50:07.988846342Z     Metadata:
2020-03-14T23:50:07.992376258Z [rawvideo @ 0x55d069a9b860] Encoder did not produce proper pts, making some up.

[h264 @ 0x55d069a996e0] left block unavailable for requested intra4x4 mode -13kbits/s speed=0.867x    33272.3kbits/s speed=0.863x
2020-03-14T23:51:15.979640873Z [h264 @ 0x55d069a996e0] error while decoding MB 0 40, bytestream 567
frame=  166 fps=2.2 q=-0.0 Lsize= 1008450kB time=00:00:11.06 bitrate=746496.0kbits/s speed=0.15x      33272.3kbits/s speed=0.868x
2020-03-14T23:51:21.105374510Z video:1008450kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
2020-03-14T23:51:21.118845678Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.119664369Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.119854713Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.121796411Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.121989780Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122060902Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122114881Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122168823Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122230640Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122283765Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122342408Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122400707Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122458740Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122525032Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122602316Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122669879Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122728067Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122786009Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122844488Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122904250Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.122962501Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123024241Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123081785Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123141993Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123195500Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123248606Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123307590Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123360325Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123419900Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123472609Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123529457Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123592748Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123652288Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123714181Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123771743Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123824831Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123884548Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.123968003Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124037100Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124096082Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124148848Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124208095Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124270301Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124323611Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124382325Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124435180Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124492559Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124545153Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124617767Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124673401Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124726422Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124786527Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124842975Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124903353Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.124955651Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125019096Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125079018Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125137556Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125196153Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125248583Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125307881Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125363054Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125419971Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125472484Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125530085Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125593261Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125653533Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125705780Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125775115Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125836660Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.125959845Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126026662Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126084620Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126137602Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126190424Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126252952Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126332631Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126386835Z driveway: ffmpeg didnt return a frame. something is wrong.
2020-03-14T23:51:21.126440916Z driveway: ffmpeg process is not running. exiting capture thread...


2020-03-14T23:51:25.243919220Z Creating ffmpeg process...
2020-03-14T23:51:25.244525548Z ffmpeg -loglevel info -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -vsync drop -rtsp_transport tcp -stimeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://user:[email protected]/live -f rawvideo -pix_fmt rgb24 pipe:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers/s speed=0.869x    33272.3kbits/s speed=0.868x
2020-03-14T23:51:25.403158843Z   built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
2020-03-14T23:51:25.403263520Z   configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
2020-03-14T23:51:25.403510851Z   libavcodec     57.107.100 / 57.107.100
2020-03-14T23:51:25.403564832Z   libavformat    57. 83.100 / 57. 83.100
2020-03-14T23:51:25.403645341Z   libavdevice    57. 10.100 / 57. 10.100
Guessed Channel Layout for Input Stream #0.1 : mono:13:29.30 bitrate=1433272.3kbits/s speed=0.869x    33272.3kbits/s speed=0.869x
2020-03-14T23:51:27.013238246Z Input #0, rtsp, from 'rtsp://user:[email protected]/live':
2020-03-14T23:51:27.013479130Z   Metadata:
2020-03-14T23:51:27.013597470Z     title           : Session streamed by "wyze"
Output #0, rawvideo, to 'pipe:':      0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    =1433272.3kbits/s speed=0.869x
2020-03-14T23:51:27.885216623Z   Metadata:
2020-03-14T23:51:27.885283731Z     title           : Session streamed by "wyze"
2020-03-14T23:51:27.885346571Z     comment         : live
2020-03-14T23:51:27.885592444Z     Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080, q=2-31, 746496 kb/s, 15 fps, 15 tbn, 15 tbc
2020-03-14T23:51:27.885725210Z     Metadata:
2020-03-14T23:51:27.885785304Z       encoder         : Lavc57.107.100 rawvideo
2020-03-14T23:51:27.890850205Z [rawvideo @ 0x555ec002c680] Encoder did not produce proper pts, making some up.

@hasshoolio

what settings are you using with your Wyze cam?
do they match mine?

On mobile right now but look back at a recent post i made with graphs and logs. My ffmpeg command line is in there. One big diff is I don’t run 1080p. I’m on 0.5.1-rc2 and I think it’s failing pretty quick. I can look at logs later tonight.

And you are using the Wyzecam V2 with the latest RTSP firmware? Mine is 15fps at 1080p.

yes. v 4.28.4.41

are you referring to this line in the config?

    take_frame: 1
    fps: 5  <---- should this be 15?
    snapshots:

I don’t think it will change the failure rate, but that number should be whatever your camera outputs, not your desired fps. The take_frame setting is used to reduce the fps. Setting take_frame to 3 would process every third frame and reduce to 5 fps.

it runs at 15 during day and drops to 10 in night mode.
Would there be an issue having it at 15 when it drops to 10?

What is your take_frame set to?

I would set it to 10 then. Frigate will try and prevent the fps from dropping below that number by skipping frames. My take_frame is 1.

It recovers but there are a bunch of restarts.
I’m tracking the PID and the bottom shows every time it changes due to a restart.
You can also see the restart as a dip on the top graph

Hi Blake

I’ve come across a small problem on 0.5.1-rc1 and 0.5.1-rc2.

I have a number of Reolink cameras using the RTMP stream (as it seems more robust than RTSP on these cameras). Frigate does not restart the stream when these are rebooted/disconnected. Nothing additional comes up in the log (loglevel info). The debug stream and the debug stats FPS remain stuck at what they were prior to the disconnection.

The RTSP stream works as expected - the stream is restarted successfully. This was not a problem on 0.4.0 and prior.

Many thanks :slight_smile:

Can you try with just one camera? Curious if having multiple is making yours restart more frequently than mine.

Can you compare the ffmpeg command from the logs between 0.4.0 and 0.5.1-rc2? It is the same version of ffmpeg.

I’ve removed the second camera from the config and it’s still restarting.
I don’t know if this is related, but it’s constantly showing the bounding boxes on a neighbor’s car.

https://youtu.be/TiFxUdMQ46w. (I cropped it to just show the car)

btw… it doesn’t happen consistently. also, it’s currently raining here so maybe the rain is messing with the image. There are 2 other cars in view but they aren’t getting the bounding boxes.