Local realtime person detection for RTSP cameras

Thanks. These will be useful when I start working to reduce false positives.

What camera are you taking a snapshot of? Did you setup an MQTT camera for images from frigate? The MQTT image is sent immediately after the sensor message.

Hi, i’m just using the url of the best.jpg to send the data:

automation:
  - alias: Frigate FrontKvish person detection 
    trigger: 
      platform: state
      entity_id: binary_sensor.frigate_frontkvish_person
      from: 'off'
      to: 'on'
    condition:
      - condition: state
        entity_id: alarm_control_panel.house
        state: armed_away
    action:
      - service: notify.all_telegram
        data:
          message: "FrontKvish - A person was detected."
          data:
            photo:
              - url: http://192.168.x.x:5000/frontkvish/person/best.jpg
                caption: A person was detected.

where 192.168.x.x:5000 is my docker address.

it sends it as an image message, not the url.
maybe the IOS notification service works in the same way?

Has anybody tried 0.5.1-rc4 with a Wyze-cam RTSP?

I ended up removing my Wyze cam from rc3 since it caused the whole thing to fall over without recovery. Hoping rc3 is better.

hey Kyle, is your camera set to reboot every night ? maybe it match the time for frigate stopping.
ill try to disable the automatic reboot on my cameras and see how it turns out with frigate

I just noticed two things re: live555

  1. dafang has a beta branch
  2. this was a recent commit https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/commit/23085855529f7c9c7461fbf020b94c301a5da53f

I just updated, we’ll see if it is a more stable stream

I do have them set to reboot on Sundays. It never caused problems on the 0.4 releases though.

It also isn’t affecting them in the same way… unless the both reboot at a different speed. I’m curious to see what the logs show me.

I tried taking a snapshot of the last_person camera that I setup based on your config example.

Example:

camera:
  - name: Front Left Last Person
    platform: mqtt
    topic: frigate/front_left/person/snapshot

I guess I could directly subscribe to the mqtt topic (i.e. frigate/front_left/person/snapshot), but I would still need to copy it to the www directly somehow for the ios notification to work.

Thanks.

iOS notifications expect the image to be reachable over the internet, hence the need to copy over to the www directory.

me too, i tried using rtsp on the reolink, but its unstable and most time frigate stop stream or not even join :frowning: so the only way i can get it to work is using rtmp.

lets see what the logs say, when you have a new event.

You might need a small delay in your automation as the camera snapshot mqtt message is sent immediately after the message for the sensor. There may be a way to check when the last update for the camera was as well.

Based on @nic0dk’s idea, I find their hypothesis correct.

Rebooting the Reolink cameras gives a 100% reproducibility rate. My cameras are accessed over rtmp
(not rtsp). The ffmpeg rtmp stream never restarts in frigate after the camera restarts. I’m wondering if it’s an issue between ffmpeg and rtmp.

Below I restarted the camera at ~2020-04-28T13:40:07.

Since the info logging wasn’t showing anything when the stream died, I bumped it up to debug. I don’t think anything meaningful shows up the moment before or after it loses connection.

2020-04-28T13:40:07.101000828Z [AVHWFramesContext @ 0x55b7fa0ddf00] Map surface 0x4000013.
2020-04-28T13:40:07.105457311Z [AVHWFramesContext @ 0x55b7fa0ddf00] Unmap surface 0x4000013.
2020-04-28T13:40:07.113358069Z [h264 @ 0x55b7fa13a640] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:40:07.113379160Z [h264 @ 0x55b7fa13a640] Param buffer (type 0, 672 bytes) is 0x8000000.
2020-04-28T13:40:07.113382270Z [h264 @ 0x55b7fa13a640] Param buffer (type 1, 240 bytes) is 0x8000001.
2020-04-28T13:40:07.113385072Z [h264 @ 0x55b7fa13a640] Slice 0 param buffer (3128 bytes) is 0x8000002.
2020-04-28T13:40:07.113387572Z [h264 @ 0x55b7fa13a640] Slice 0 data buffer (6128 bytes) is 0x8000003.
2020-04-28T13:40:07.113389810Z [h264 @ 0x55b7fa13a640] Decode to surface 0x4000012.
2020-04-28T13:40:07.113945962Z [AVHWFramesContext @ 0x55b7fa0ddf00] Map surface 0x4000012.
2020-04-28T13:40:07.117220247Z [AVHWFramesContext @ 0x55b7fa0ddf00] Unmap surface 0x4000012.
[h264 @ 0x55b7fa13a640] nal_unit_type: 1, nal_ref_idc: 10 size= 3218400kB time=00:00:27.09 bitrate=973209.6kbits/s speed=1.06x
2020-04-28T13:40:07.128931262Z [h264 @ 0x55b7fa13a640] Param buffer (type 0, 672 bytes) is 0x8000003.
2020-04-28T13:40:07.128946750Z [h264 @ 0x55b7fa13a640] Param buffer (type 1, 240 bytes) is 0x8000002.
2020-04-28T13:40:07.128949746Z [h264 @ 0x55b7fa13a640] Slice 0 param buffer (3128 bytes) is 0x8000001.
2020-04-28T13:40:07.128952303Z [h264 @ 0x55b7fa13a640] Slice 0 data buffer (6303 bytes) is 0x8000000.
2020-04-28T13:40:07.128954886Z [h264 @ 0x55b7fa13a640] Decode to surface 0x4000013.
2020-04-28T13:40:07.129174373Z [AVHWFramesContext @ 0x55b7fa0ddf00] Map surface 0x4000013.
2020-04-28T13:40:07.132475445Z [AVHWFramesContext @ 0x55b7fa0ddf00] Unmap surface 0x4000013.

But I did attempt to print out any debug stack for the ffmpeg PID (at 2020-04-28T13:45:48). As soon as I do though it seems to get it out of the unstuck state and it starts working again.

2020-04-28T13:45:48.051835253Z Splitting the commandline.
2020-04-28T13:45:48.051874324Z Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
2020-04-28T13:45:48.051878239Z Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
2020-04-28T13:45:48.051899535Z Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'vaapi'.
2020-04-28T13:45:48.051902175Z Reading option '-hwaccel_device' ... matched as option 'hwaccel_device' (select a device for HW acceleration) with argument '/dev/dri/renderD128'.
2020-04-28T13:45:48.051904824Z Reading option '-hwaccel_output_format' ... matched as option 'hwaccel_output_format' (select output format used with HW accelerated decoding) with argument 'yuv420p'.
2020-04-28T13:45:48.052334934Z Reading option '-avoid_negative_ts' ... matched as AVOption 'avoid_negative_ts' with argument 'make_zero'.
2020-04-28T13:45:48.052747011Z Reading option '-fflags' ... matched as AVOption 'fflags' with argument 'nobuffer'.
2020-04-28T13:45:48.053035611Z Reading option '-flags' ... matched as AVOption 'flags' with argument 'low_delay'.
2020-04-28T13:45:48.053337995Z Reading option '-strict' ...Routing option strict to both codec and muxer layer
2020-04-28T13:45:48.053344543Z  matched as AVOption 'strict' with argument 'experimental'.
2020-04-28T13:45:48.053709300Z Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+genpts+discardcorrupt'.
2020-04-28T13:45:48.053718401Z Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument 'drop'.
2020-04-28T13:45:48.054055881Z Reading option '-use_wallclock_as_timestamps' ... matched as AVOption 'use_wallclock_as_timestamps' with argument '1'.
2020-04-28T13:45:48.054106354Z Reading option '-i' ... matched as input url with argument 'rtmp://192.168.1.50:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword'.
2020-04-28T13:45:48.054110298Z Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
2020-04-28T13:45:48.054112593Z Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'rgb24'.
2020-04-28T13:45:48.054128908Z Reading option 'pipe:' ... matched as output url.
2020-04-28T13:45:48.054130973Z Finished splitting the commandline.
2020-04-28T13:45:48.054133039Z Parsing a group of options: global .
2020-04-28T13:45:48.054136156Z Applying option hide_banner (do not show program banner) with argument 1.
2020-04-28T13:45:48.054138389Z Applying option loglevel (set logging level) with argument debug.
2020-04-28T13:45:48.054140486Z Applying option vsync (video sync method) with argument drop.
2020-04-28T13:45:48.054142536Z Successfully parsed a group of options.
2020-04-28T13:45:48.054144675Z Parsing a group of options: input url rtmp://192.168.1.50:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword.
2020-04-28T13:45:48.054146967Z Applying option hwaccel (use HW accelerated decoding) with argument vaapi.
2020-04-28T13:45:48.054149003Z Applying option hwaccel_device (select a device for HW acceleration) with argument /dev/dri/renderD128.
2020-04-28T13:45:48.054151085Z Applying option hwaccel_output_format (select output format used with HW accelerated decoding) with argument yuv420p.
2020-04-28T13:45:48.054153170Z Successfully parsed a group of options.
2020-04-28T13:45:48.054174338Z Opening an input file: rtmp://192.168.1.50:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword.
2020-04-28T13:45:48.054196247Z [NULL @ 0x55bc3261db60] Opening 'rtmp://192.168.1.50:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword' for reading
2020-04-28T13:45:48.054201218Z [rtmp @ 0x55bc3261e5a0] No default whitelist set
2020-04-28T13:45:48.054203477Z [tcp @ 0x55bc3261ed20] No default whitelist set
2020-04-28T13:45:48.059065941Z [rtmp @ 0x55bc3261e5a0] Handshaking...
2020-04-28T13:45:48.081054350Z [rtmp @ 0x55bc3261e5a0] Type answer 3
2020-04-28T13:45:48.081144379Z [rtmp @ 0x55bc3261e5a0] Server version 13.14.10.13
2020-04-28T13:45:48.081473630Z [rtmp @ 0x55bc3261e5a0] Proto = rtmp, path = /bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword, app = bcs, fname = channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword
2020-04-28T13:45:48.091285804Z [rtmp @ 0x55bc3261e5a0] Window acknowledgement size = 5000000
2020-04-28T13:45:48.152725243Z [rtmp @ 0x55bc3261e5a0] Max sent, unacked = 5000000
2020-04-28T13:45:48.152747911Z [rtmp @ 0x55bc3261e5a0] New incoming chunk size = 4096
2020-04-28T13:45:48.152769824Z [rtmp @ 0x55bc3261e5a0] Creating stream...
2020-04-28T13:45:48.203121978Z [rtmp @ 0x55bc3261e5a0] Sending play command for 'channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword'
2020-04-28T13:45:50.027157386Z [flv @ 0x55bc3261db60] Format flv probed with size=2048 and score=100
2020-04-28T13:45:50.030180184Z [flv @ 0x55bc3261db60] Before avformat_find_stream_info() pos: 13 bytes read:33107 seeks:0 nb_streams:0
2020-04-28T13:45:50.030211790Z [flv @ 0x55bc3261db60] Unknown type |RtmpSampleAccess
2020-04-28T13:45:50.030637563Z [NULL @ 0x55bc32622c40] nal_unit_type: 7, nal_ref_idc: 3
2020-04-28T13:45:50.030716636Z [NULL @ 0x55bc32622c40] nal_unit_type: 8, nal_ref_idc: 3
2020-04-28T13:45:50.031900330Z [h264 @ 0x55bc32622c40] nal_unit_type: 7, nal_ref_idc: 3
2020-04-28T13:45:50.031939317Z [h264 @ 0x55bc32622c40] nal_unit_type: 8, nal_ref_idc: 3
2020-04-28T13:45:50.033210665Z [h264 @ 0x55bc32622c40] nal_unit_type: 5, nal_ref_idc: 3
2020-04-28T13:45:50.033244521Z [h264 @ 0x55bc32622c40] Reinit context to 2560x1440, pix_fmt: yuv420p
2020-04-28T13:45:50.073806029Z [h264 @ 0x55bc32622c40] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:50.086989696Z     Last message repeated 2 times
2020-04-28T13:45:50.087027854Z [flv @ 0x55bc3261db60] Non-increasing DTS in stream 0: packet 4 with DTS 1588081550087, packet 5 with DTS 1588081550087
2020-04-28T13:45:50.090888342Z [h264 @ 0x55bc32622c40] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:52.056366888Z     Last message repeated 2 times
2020-04-28T13:45:52.056396366Z [flv @ 0x55bc3261db60] Non-increasing DTS in stream 0: packet 34 with DTS 1588081552056, packet 35 with DTS 1588081552056
2020-04-28T13:45:53.086745770Z [flv @ 0x55bc3261db60] All info found
2020-04-28T13:45:53.091126776Z [flv @ 0x55bc3261db60] After avformat_find_stream_info() pos: 752770 bytes read:752770 seeks:0 frames:93
2020-04-28T13:45:53.091439019Z Input #0, flv, from 'rtmp://192.168.1.50:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=fakepassword':
2020-04-28T13:45:53.091537724Z   Metadata:
2020-04-28T13:45:53.091574494Z     displayWidth    : 2560
2020-04-28T13:45:53.091603573Z     displayHeight   : 1440
2020-04-28T13:45:53.091630643Z   Duration: 00:00:00.00, start: 1588081550.030000, bitrate: N/A
2020-04-28T13:45:53.091707504Z     Stream #0:0, 52, 1/1000: Audio: aac (LC), 16000 Hz, mono, fltp
2020-04-28T13:45:53.091905150Z     Stream #0:1, 41, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 2560x1440, 0/1, 12 fps, 1k tbr, 1k tbn
2020-04-28T13:45:53.091984670Z Successfully opened the file.
2020-04-28T13:45:53.092022513Z Parsing a group of options: output url pipe:.
2020-04-28T13:45:53.092053321Z Applying option f (force format) with argument rawvideo.
2020-04-28T13:45:53.092081711Z Applying option pix_fmt (set pixel format) with argument rgb24.
2020-04-28T13:45:53.092113602Z Successfully parsed a group of options.
2020-04-28T13:45:53.092190318Z Opening an output file: pipe:.
2020-04-28T13:45:53.092750816Z [pipe @ 0x55bc3262cbc0] Setting default whitelist 'crypto'
2020-04-28T13:45:53.092819215Z Successfully opened the file.
2020-04-28T13:45:53.093140437Z [AVHWDeviceContext @ 0x55bc32621360] Opened VA display via DRM device /dev/dri/renderD128.
2020-04-28T13:45:53.093301403Z [AVHWDeviceContext @ 0x55bc32621360] libva: VA-API version 1.1.0
2020-04-28T13:45:53.093389955Z [AVHWDeviceContext @ 0x55bc32621360] libva: va_getDriverName() returns 0
2020-04-28T13:45:53.093429001Z [AVHWDeviceContext @ 0x55bc32621360] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
2020-04-28T13:45:53.096302560Z [AVHWDeviceContext @ 0x55bc32621360] libva: Found init function __vaDriverInit_1_1
2020-04-28T13:45:53.099919917Z [AVHWDeviceContext @ 0x55bc32621360] libva: va_openDriver() returns 0
2020-04-28T13:45:53.099998656Z [AVHWDeviceContext @ 0x55bc32621360] Initialised VAAPI connection: version 1.1
2020-04-28T13:45:53.100023748Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x32315659 -> yuv420p.
2020-04-28T13:45:53.100046144Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x30323449 -> unknown.
2020-04-28T13:45:53.100069665Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x3231564e -> nv12.
2020-04-28T13:45:53.100093357Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x32595559 -> yuyv422.
2020-04-28T13:45:53.100116380Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x59565955 -> uyvy422.
2020-04-28T13:45:53.100137970Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x48323234 -> yuv422p.
2020-04-28T13:45:53.100158381Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x58424752 -> rgb0.
2020-04-28T13:45:53.100180920Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x58524742 -> bgr0.
2020-04-28T13:45:53.100203277Z [AVHWDeviceContext @ 0x55bc32621360] Format 0x30313050 -> p010le.
2020-04-28T13:45:53.100225389Z [AVHWDeviceContext @ 0x55bc32621360] Matched "Intel i965 driver for Intel(R) Coffee Lake - 2.1.0" as known driver "Intel i965 (Quick Sync)".
2020-04-28T13:45:53.100380343Z detected 8 logical cores
2020-04-28T13:45:53.105037446Z [h264 @ 0x55bc327c8da0] nal_unit_type: 7, nal_ref_idc: 3
2020-04-28T13:45:53.105179118Z [h264 @ 0x55bc327c8da0] nal_unit_type: 8, nal_ref_idc: 3
2020-04-28T13:45:53.105223352Z Stream mapping:
2020-04-28T13:45:53.105260260Z   Stream #0:1 -> #0:0 (h264 (native) -> rawvideo (native))
2020-04-28T13:45:53.105297059Z Press [q] to stop, [?] for help
2020-04-28T13:45:53.105330791Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.194554119Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.194685102Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000000.
2020-04-28T13:45:53.194744901Z [AVHWFramesContext @ 0x55bc326c06c0] Direct mapping possible.
2020-04-28T13:45:53.194928688Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000001.
2020-04-28T13:45:53.194980271Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000002.
2020-04-28T13:45:53.195023756Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000003.
2020-04-28T13:45:53.195055382Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000004.
2020-04-28T13:45:53.195084939Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000005.
2020-04-28T13:45:53.195116509Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000006.
2020-04-28T13:45:53.195154155Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000007.
2020-04-28T13:45:53.195191963Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000008.
2020-04-28T13:45:53.195234912Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000009.
2020-04-28T13:45:53.195282638Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000a.
2020-04-28T13:45:53.195313930Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000b.
2020-04-28T13:45:53.195346172Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000c.
2020-04-28T13:45:53.195387599Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000d.
2020-04-28T13:45:53.195418379Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000e.
2020-04-28T13:45:53.195446648Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x400000f.
2020-04-28T13:45:53.195499774Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000010.
2020-04-28T13:45:53.195543455Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000011.
2020-04-28T13:45:53.195738000Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000012.
2020-04-28T13:45:53.195822880Z [AVHWFramesContext @ 0x55bc326c06c0] Created surface 0x4000013.
2020-04-28T13:45:53.196658369Z [h264 @ 0x55bc327c8da0] Decode context initialised: 0x1000000/0x2000000.
2020-04-28T13:45:53.196732960Z [h264 @ 0x55bc327c8da0] Reinit context to 2560x1440, pix_fmt: vaapi_vld
2020-04-28T13:45:53.200035513Z [h264 @ 0x55bc327c8da0] Frame num gap 1 15
2020-04-28T13:45:53.212213523Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000000.
2020-04-28T13:45:53.212300127Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000001.
2020-04-28T13:45:53.212328193Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000002.
2020-04-28T13:45:53.212351777Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (9016 bytes) is 0x8000003.
2020-04-28T13:45:53.212375088Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000012.
2020-04-28T13:45:53.226055010Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.247469234Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.247700510Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000003.
2020-04-28T13:45:53.247818055Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000002.
2020-04-28T13:45:53.247897591Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000001.
2020-04-28T13:45:53.247931308Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (8011 bytes) is 0x8000000.
2020-04-28T13:45:53.247956744Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000013.
2020-04-28T13:45:53.250439456Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.352229096Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.352260743Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000000.
2020-04-28T13:45:53.352267835Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000001.
2020-04-28T13:45:53.352273452Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000002.
2020-04-28T13:45:53.352285158Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (9110 bytes) is 0x8000003.
2020-04-28T13:45:53.352289313Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000012.
2020-04-28T13:45:53.352815002Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.441131329Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.441225239Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000003.
2020-04-28T13:45:53.441267370Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000002.
2020-04-28T13:45:53.441283561Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000001.
2020-04-28T13:45:53.441298973Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (8055 bytes) is 0x8000000.
2020-04-28T13:45:53.441313676Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000013.
2020-04-28T13:45:53.441925785Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.533541353Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.533599837Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000000.
2020-04-28T13:45:53.533609637Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000001.
2020-04-28T13:45:53.533616619Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000002.
2020-04-28T13:45:53.533622507Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (9093 bytes) is 0x8000003.
2020-04-28T13:45:53.533628510Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000012.
2020-04-28T13:45:53.534292379Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.589854134Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.589891729Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000003.
2020-04-28T13:45:53.589901845Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000002.
2020-04-28T13:45:53.589908604Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000001.
2020-04-28T13:45:53.589930425Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (8293 bytes) is 0x8000000.
2020-04-28T13:45:53.589936944Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000013.
2020-04-28T13:45:53.590492673Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
2020-04-28T13:45:53.701921405Z [h264 @ 0x55bc327c8da0] nal_unit_type: 1, nal_ref_idc: 1
2020-04-28T13:45:53.701979247Z [h264 @ 0x55bc327c8da0] Param buffer (type 0, 672 bytes) is 0x8000000.
2020-04-28T13:45:53.701993481Z [h264 @ 0x55bc327c8da0] Param buffer (type 1, 240 bytes) is 0x8000001.
2020-04-28T13:45:53.702004183Z [h264 @ 0x55bc327c8da0] Slice 0 param buffer (3128 bytes) is 0x8000002.
2020-04-28T13:45:53.702016752Z [h264 @ 0x55bc327c8da0] Slice 0 data buffer (10568 bytes) is 0x8000003.
2020-04-28T13:45:53.702026144Z [h264 @ 0x55bc327c8da0] Decode to surface 0x4000012.
2020-04-28T13:45:53.702630976Z cur_dts is invalid (this is harmless if it occurs once at the start per stream)
...

Does the ffmpeg pid change when you do that? Also, are you using the ffmpeg_pid value?

Yes, the ffmpeg pid does change and replaces the older PID under the /debug/stats when try to print the stack.

I was using ffmpeg_pid for the /debug/print_stack?pid=PID command.

Ok. The signal that the print_stack command uses causes the ffmpeg process to restart. I should be able to detect when the ffmpeg process is no longer returning frames and trigger a restart.

1 Like

Will it be a retry back-off, or a constant retry attempt?

Just trying to think of scenarios where the camera is slow to reboot, or it became unplugged. Or allowing it to still retry if the camera had been off for a few hours (like if there was a power outage).

It will keep retrying indefinitely.

1 Like

Hey @blakeblackshear, I’m giving rc4 a try with the same config that would run for a couple days on rc1, but I’m getting the following after about a minute:

On connect called
Traceback (most recent call last):
  File "detect_objects.py", line 348, in <module>
Starting detection process: 21
/arrow/cpp/src/plasma/io.cc:168: Connection to IPC socket failed for pathname /tmp/plasma, retrying 20 more times
    main()
  File "detect_objects.py", line 175, in main
    ffmpeg_input = get_ffmpeg_input(ffmpeg['input'])
KeyError: 'input'

Here’s my docker compose

docker run --rm --privileged --shm-size=1g -v /dev/bus/usb:/dev/bus/usb -v /volume1/docker/frigate/config:/config:ro -v /etc/localtime:/etc/localtime:ro -v /volume1/docker/frigate/storage:/storage -p 4000:4000 -e FRIGATE_MQTT_PASSWORD='PooPoo22' -e FRIGATE_RTSP_PASSWORD='PW' -e FRIGATE_RTSP_PASSWORD_RIGHT='PW' -e FRIGATE_RTSP_PASSWORD_LEFT='PW' -e FRIGATE_RTSP_PASSWORD_FRONT='PW' -e FRIGATE_RTSP_PASSWORD_BACK='PW' -e PYTHONPATH='/usr/local/lib/python3.5/dist-packages/tensorflow/models/research:/usr/local/lib/python3.5/dist-packages/tensorflow/models/research/slim' blakeblackshear/frigate:0.5.1-rc4 &

Any idea why?

Are you sure your config didn’t change? It is complaining that your input value is missing under ffmpeg for one of your cameras.

Whoops, didn’t sleep enough last night… Was still pointing at my v2 config file. Now running, will see how long it can go on 4 1080p streams with 768m shm.