blakeblackshear / frigate

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

[Camera Support]: problems with a camera since upgrade to 0.11 #3778

Closed alexdelprete closed 2 years ago

alexdelprete commented 2 years ago

Describe the problem you are having

Never had big issues with frigate, hwaccel was working fine, coral usb too. Now I upgraded to 0.11rc2. Always had a very clean log, no errors. Now the log is full of errors for one specific camera. Frigate seems to be working, but not constantly.

Tried disabling hwaccel in the config, but the errors remain the same. Looks like something related to ffmpeg of this version, but I'm not sure.

I have another camera (Eufy Indoor Cam 2k) that seems to be working fine also with 0.11.

Version

0.11.0-C461C9E

Frigate config file

mqtt:
  # Required: host name
  host: mqtt.axel.dom
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  topic_prefix: frigate
  # Optional: client id (default: shown below)
  # NOTE: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: mqtt_ha
  # Optional: password
  # NOTE: MQTT password can be specified with an environment variables that must begin with 'FRIGATE_'.
  #       e.g. password: '{FRIGATE_MQTT_PASSWORD}'
  password: ha_mqtt
  # Optional: tls_ca_certs for enabling TLS using self-signed certs (default: None)
  #tls_ca_certs: /path/to/ca.crt
  # Optional: tls_client_cert and tls_client key in order to use self-signed client
  # certificates (default: None)
  # NOTE: certificate must not be password-protected
  #       do not set user and password when using a client certificate
  #tls_client_cert: /path/to/client.crt
  #tls_client_key: /path/to/client.key
  # Optional: tls_insecure (true/false) for enabling TLS verification of
  # the server hostname in the server certificate (default: None)
  #tls_insecure: false
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60

# Optional: Detectors configuration. Defaults to a single CPU detector
detectors:
  # Required: name of the detector
  coral:
    # Required: type of the detector
    # Valid values are 'edgetpu' (requires device property below) and 'cpu'.
    type: edgetpu
    # Optional: device name as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
    device: usb
    # Optional: num_threads value passed to the tflite.Interpreter (default: shown below)
    # This value is only used for CPU types
    num_threads: 3

# Optional: Database configuration
database:
  # The path to store the SQLite DB (default: shown below)
  path: /db/frigate.db

# Optional: model modifications
model:
  # Optional: path to the model (default: automatic based on detector)
  path: /edgetpu_model.tflite
  # Optional: path to the labelmap (default: shown below)
  labelmap_path: /labelmap.txt
  # Required: Object detection model input width (default: shown below)
  width: 320
  # Required: Object detection model input height (default: shown below)
  height: 320
  # Optional: Label name modifications. These are merged into the standard labelmap.
  labelmap:
    2: vehicle

# Optional: logger verbosity settings
logger:
  # Optional: Default log verbosity (default: shown below)
  default: info
  # Optional: Component specific logger overrides
  logs:
    frigate.event: info
    detector.coral: debug
    ffmpeg.cifotono: debug

# Optional: set environment variables
environment_vars:
  PLUS_API_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXX

# Optional: birdseye configuration
# NOTE: Can (enabled, mode) be overridden at the camera level
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: True
  # Optional: Width of the output resolution (default: shown below)
  width: 768
  # Optional: Height of the output resolution (default: shown below)
  height: 1024
  # Optional: Encoding quality of the mpeg1 feed (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 5
  # Optional: Mode of the view. Available options are: objects, motion, and continuous
  #   objects - cameras are included if they have had a tracked object within the last 30 seconds
  #   motion - cameras are included if motion was detected in the last 30 seconds
  #   continuous - all cameras are included always
  mode: objects

# Optional: ffmpeg configuration
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format yuv420p
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an
    # Optional: output args for rtmp streams (default: shown below)
    rtmp: -c copy -f flv

# Optional: Detect configuration
# NOTE: Can be overridden at the camera level
detect:
  # Optional: width of the frame for the input with the detect role (default: shown below)
  width: 1920
  # Optional: height of the frame for the input with the detect role (default: shown below)
  height: 1080
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 6
  # Optional: enables detection for the camera (default: True)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 30
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for confirming stationary objects (default: shown below)
    # When set to 0, object detection will not confirm stationary objects until movement is detected.
    # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
    interval: 0
    # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
    threshold: 50
    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
    # car at the default.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
      default: 3000
      # Optional: Object specific values
      objects:
        person: 1000

# Optional: Object configuration
# NOTE: Can be overridden at the camera level
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
  # Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
  # Checks based on the bottom center of the bounding box of the object.
  # NOTE: This mask is COMBINED with the object type specific mask below
  mask: 0,0,1000,0,1000,200,0,200
  # Optional: filters to reduce false positives for specific object types
  filters:
    person:
      # Optional: minimum width*height of the bounding box for the detected object (default: 0)
      min_area: 5000
      # Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
      max_area: 100000
      # Optional: minimum width/height of the bounding box for the detected object (default: 0)
      min_ratio: 0.5
      # Optional: maximum width/height of the bounding box for the detected object (default: 24000000)
      max_ratio: 2.0
      # Optional: minimum score for the object to initiate tracking (default: shown below)
      min_score: 0.5
      # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
      threshold: 0.7
      # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
      # Checks based on the bottom center of the bounding box of the object
      mask: 0,0,1000,0,1000,200,0,200

# Optional: Motion configuration
# NOTE: Can be overridden at the camera level
motion:
  # Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
  # Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
  # The value should be between 1 and 255.
  threshold: 25
  # Optional: Minimum size in pixels in the resized motion image that counts as motion (default: 30)
  # Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
  # make motion detection more sensitive to smaller moving objects.
  # As a rule of thumb:
  #  - 15 - high sensitivity
  #  - 30 - medium sensitivity
  #  - 50 - low sensitivity
  contour_area: 30
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging the motion delta across multiple frames (default: shown below)
  # Higher values mean the current frame impacts the delta a lot, and a single raindrop may register as motion.
  # Too low and a fast moving person wont be detected as motion.
  delta_alpha: 0.2
  # Optional: Alpha value passed to cv2.accumulateWeighted when averaging frames to determine the background (default: shown below)
  # Higher values mean the current frame impacts the average a lot, and a new object will be averaged into the background faster.
  # Low values will cause things like moving shadows to be detected as motion for longer.
  # https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
  frame_alpha: 0.2
  # Optional: Height of the resized motion frame  (default: 50)
  # This operates as an efficient blur alternative. Higher values will result in more granular motion detection at the expense
  # of higher CPU usage. Lower values result in less CPU, but small changes may not register as motion.
  frame_height: 50
  # Optional: motion mask
  # NOTE: see docs for more detailed info on creating masks
  mask: 0,900,1080,900,1080,1920,0,1920
  # Optional: improve contrast (default: shown below)
  # Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive
  # for daytime.
  improve_contrast: False
  # Optional: Delay when updating camera motion through MQTT from ON -> OFF (default: shown below).
  mqtt_off_delay: 30

# Optional: Record configuration
# NOTE: Can be overridden at the camera level
record:
  # Optional: Enable recording (default: shown below)
  # WARNING: If recording is disabled in the config, turning it on via
  #          the UI or MQTT later will have no effect.
  # WARNING: Frigate does not currently support limiting recordings based
  #          on available disk space automatically. If using recordings,
  #          you must specify retention settings for a number of days that
  #          will fit within the available disk space of your drive or Frigate
  #          will crash.
  enabled: True
  # Optional: Number of minutes to wait between cleanup runs (default: shown below)
  # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o
  expire_interval: 60
  # Optional: Retention settings for recording
  retain:
    # Optional: Number of days to retain recordings regardless of events (default: shown below)
    # NOTE: This should be set to 0 and retention should be defined in events section below
    #       if you only want to retain recordings of events.
    days: 3
    # Optional: Mode for retention. Available options are: all, motion, and active_objects
    #   all - save all recording segments regardless of activity
    #   motion - save all recordings segments with any detected motion
    #   active_objects - save all recording segments with active/moving objects
    # NOTE: this mode only applies when the days setting above is greater than 0
    mode: all
  # Optional: Event recording settings
  events:
    # Optional: Number of seconds before the event to include (default: shown below)
    pre_capture: 30
    # Optional: Number of seconds after the event to include (default: shown below)
    post_capture: 30
    # Optional: Objects to save recordings for. (default: all tracked objects)
    objects:
      - person
    # Optional: Restrict recordings to objects that entered any of the listed zones (default: no required zones)
    required_zones: []
    # Optional: Retention settings for recordings of events
    retain:
      # Required: Default retention days (default: shown below)
      default: 5
      # Optional: Mode for retention. (default: shown below)
      #   all - save all recording segments for events regardless of activity
      #   motion - save all recordings segments for events with any detected motion
      #   active_objects - save all recording segments for event with active/moving objects
      #
      # NOTE: If the retain mode for the camera is more restrictive than the mode configured
      #       here, the segments will already be gone by the time this mode is applied.
      #       For example, if the camera retain mode is "motion", the segments without motion are
      #       never stored, so setting the mode to "all" here won't bring them back.
      mode: motion
      # Optional: Per object retention days
      objects:
        person: 5

# Optional: Configuration for the jpg snapshots written to the clips directory for each event
# NOTE: Can be overridden at the camera level
snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: clean copy
  clean_copy: False
  # Optional: print a timestamp on the snapshots (default: shown below)
  timestamp: False
  # Optional: draw bounding box on the snapshots (default: shown below)
  bounding_box: False
  # Optional: crop the snapshot (default: shown below)
  crop: False
  # Optional: height to resize the snapshot to (default: original size)
  #height: 2048
  # Optional: Restrict snapshots to objects that entered any of the listed zones (default: no required zones)
  required_zones: []
  # Optional: Camera override for retention settings (default: global values)
  retain:
    # Required: Default retention days (default: shown below)
    default: 3
    # Optional: Per object retention days
    objects:
      person: 7

# Optional: RTMP configuration
# NOTE: Can be overridden at the camera level
rtmp:
  # Optional: Enable the RTMP stream (default: True)
  enabled: True

# Optional: Live stream configuration for WebUI
# NOTE: Can be overridden at the camera level
live:
  # Optional: Set the height of the live stream. (default: 720)
  # This must be less than or equal to the height of the detect stream. Lower resolutions
  # reduce bandwidth required for viewing the live stream. Width is computed to match known aspect ratio.
  height: 1080
  # Optional: Set the encode quality of the live stream (default: shown below)
  # 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
  quality: 8

# Optional: in-feed timestamp style configuration
# NOTE: Can be overridden at the camera level
timestamp_style:
  # Optional: Position of the timestamp (default: shown below)
  #           "tl" (top left), "tr" (top right), "bl" (bottom left), "br" (bottom right)
  position: "br"
  # Optional: Format specifier conform to the Python package "datetime" (default: shown below)
  #           Additional Examples:
  #             german: "%d.%m.%Y %H:%M:%S"
  format: "%d.%m.%Y %H:%M:%S"
  # Optional: Color of font
  color:
    # All Required when color is specified (default: shown below)
    red: 255
    green: 255
    blue: 255
  # Optional: Line thickness of font (default: shown below)
  thickness: 2
  # Optional: Effect of lettering (default: shown below)
  #           None (No effect),
  #           "solid" (solid background in inverse color of font)
  #           "shadow" (shadow for font)
  effect: "solid"

# Required
cameras:
  # Required: name of the camera
  citofono:
    # Required: ffmpeg settings for the camera
    ffmpeg:
      # Required: A list of input streams for the camera. See documentation for more information.
      inputs:
        # Required: the path to the stream
        # NOTE: path may include environment variables, which must begin with 'FRIGATE_' and be referenced in {}
        - path: rtsp://XXXX:XXXXX@citofono.axel.dom:554/Streaming/Channels/101
          # Required: list of roles for this stream. valid values are: detect,record,rtmp
          # NOTICE: In addition to assigning the record, and rtmp roles,
          # they must also be enabled in the camera config.
          roles:
            - record
            - rtmp
          # Optional: stream specific global args (default: inherit)
          # global_args:
          # Optional: stream specific hwaccel args (default: inherit)
          # hwaccel_args:
          # Optional: stream specific input args (default: inherit)
          # input_args:
        - path: rtsp://XXXX:XXXXX@citofono.axel.dom:554/Streaming/Channels/102
          roles:
            - detect
      # Optional: camera specific global args (default: inherit)
      # global_args:
      # Optional: camera specific hwaccel args (default: inherit)
      # hwaccel_args:
      # Optional: camera specific input args (default: inherit)
      # input_args:
      # Optional: camera specific output args (default: inherit)
      # output_args:

    detect:
      # Optional: width of the frame for the input with the detect role (default: shown below)
      width: 384
      # Optional: height of the frame for the input with the detect role (default: shown below)
      height: 512
      # Optional: desired fps for your camera for the input with the detect role (default: shown below)
      # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
      fps: 6
      # Optional: enables detection for the camera (default: True)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True

    # Optional: timeout for highest scoring image before allowing it
    # to be replaced by a newer image. (default: shown below)
    best_image_timeout: 60

    # Optional: zones for this camera
    zones:
      # Required: name of the zone
      # NOTE: This must be different than any camera names, but can match with another zone on another
      #       camera.
      cancelli:
        # Required: List of x,y coordinates to define the polygon of the zone.
        # NOTE: Presence in a zone is evaluated only based on the bottom center of the objects bounding box.
        coordinates: 545,1077,747,939,788,805
        # Optional: List of objects that can trigger this zone (default: all tracked objects)
        objects:
          - person
        # Optional: Zone level object filters.
        # NOTE: The global and camera filters are applied upstream.
        filters:
          person:
            min_area: 5000
            max_area: 100000
            threshold: 0.7

    # Optional: Configuration for the jpg snapshots published via MQTT
    mqtt:
      # Optional: Enable publishing snapshot via mqtt for camera (default: shown below)
      # NOTE: Only applies to publishing image data to MQTT via 'frigate/<camera_name>/<object_name>/snapshot'.
      # All other messages will still be published.
      enabled: True
      # Optional: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: False
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: shown below)
      height: 2048
      # Optional: jpeg encode quality (default: shown below)
      quality: 90
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: []

  living:
    # Required: ffmpeg settings for the camera
    ffmpeg:
      # Required: A list of input streams for the camera. See documentation for more information.
      inputs:
        # Required: the path to the stream
        # NOTE: path may include environment variables, which must begin with 'FRIGATE_' and be referenced in {}
        - path: rtsp://XXXX:XXXXX@10.1.10.115/live0
          # Required: list of roles for this stream. valid values are: detect,record,rtmp
          # NOTICE: In addition to assigning the record, and rtmp roles,
          # they must also be enabled in the camera config.
          roles:
            - record
            - rtmp
          # Optional: stream specific global args (default: inherit)
          # global_args:
          # Optional: stream specific hwaccel args (default: inherit)
          # hwaccel_args:
          # Optional: stream specific input args (default: inherit)
          # input_args:
        - path: rtsp://XXXX:XXXXX@10.1.10.115/live0
          roles:
            - detect
      # Optional: camera specific global args (default: inherit)
      # global_args:
      # Optional: camera specific hwaccel args (default: inherit)
      # hwaccel_args:
      # Optional: camera specific input args (default: inherit)
      # input_args:
      # Optional: camera specific output args (default: inherit)
      # output_args:

    detect:
      # Optional: width of the frame for the input with the detect role (default: shown below)
      width: 1920
      # Optional: height of the frame for the input with the detect role (default: shown below)
      height: 1080
      # Optional: desired fps for your camera for the input with the detect role (default: shown below)
      # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
      fps: 5
      # Optional: enables detection for the camera (default: True)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: False

    # Optional: timeout for highest scoring image before allowing it
    # to be replaced by a newer image. (default: shown below)
    best_image_timeout: 60

    # Optional: zones for this camera
    zones:
      # Required: name of the zone
      # NOTE: This must be different than any camera names, but can match with another zone on another
      #       camera.
      soggiorno:
        # Required: List of x,y coordinates to define the polygon of the zone.
        # NOTE: Presence in a zone is evaluated only based on the bottom center of the objects bounding box.
        coordinates: 545,1077,747,939,788,805
        # Optional: List of objects that can trigger this zone (default: all tracked objects)
        objects:
          - person
        # Optional: Zone level object filters.
        # NOTE: The global and camera filters are applied upstream.
        filters:
          person:
            min_area: 5000
            max_area: 100000
            threshold: 0.7

    # Optional: Configuration for the jpg snapshots published via MQTT
    mqtt:
      # Optional: Enable publishing snapshot via mqtt for camera (default: shown below)
      # NOTE: Only applies to publishing image data to MQTT via 'frigate/<camera_name>/<object_name>/snapshot'.
      # All other messages will still be published.
      enabled: True
      # Optional: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: False
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: shown below)
      height: 1080
      # Optional: jpeg encode quality (default: shown below)
      quality: 90
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: []

    # Optional: Configuration for how camera is handled in the GUI.
    ui:
      # Optional: Adjust sort order of cameras in the UI. Larger numbers come later (default: shown below)
      # By default the cameras are sorted alphabetically.
      order: 0
      # Optional: Whether or not to show the camera in the Frigate UI (default: shown below)
      dashboard: True

Relevant log output

[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [rtsp @ 0x55583369af80] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] cabac decode of qscale diff failed at 23 59
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] error while decoding MB 23 59, bytestream 290
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] reference count 2 overflow
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] Invalid NAL unit 0, skipping.
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : Last message repeated 1 times
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [rtsp @ 0x55583369af80] Undefined type (30)
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] error while decoding MB 83 95, bytestream 285
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [rtsp @ 0x55583369af80] RTP H.264 NAL unit type 27 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [rtsp @ 0x55583369af80] Error parsing AU headers
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [rtsp @ 0x55583369af80] nal size exceeds length: 56223 1445
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] SEI type 9 size 1424 truncated at 616
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] SEI type 45 size 1256 truncated at 984
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [h264 @ 0x5558336a1a00] missing picture in access unit with size 3936
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [segment @ 0x5558336b4800] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [flv @ 0x5558336bd580] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [segment @ 0x5558336b4800] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [flv @ 0x5558336bd580] Failed to update header with correct duration.
[2022-09-06 19:48:21] ffmpeg.citofono.record_rtmp ERROR : [flv @ 0x5558336bd580] Failed to update header with correct filesize.
[2022-09-06 19:48:21] watchdog.citofono INFO : Terminating the existing ffmpeg process...
[2022-09-06 19:48:21] watchdog.citofono INFO : Waiting for ffmpeg to exit gracefully...
[2022-09-06 19:48:31] watchdog.citofono ERROR : Ffmpeg process crashed unexpectedly for citofono.

FFprobe output from your camera

root@frigate:/usr/lib/btbn-ffmpeg/bin# ffprobe -rtsp_transport tcp -i rtsp://XXXX:XXXXX@citofono:554/Streaming/Channels/101 -select_streams v:0 -show_frames -show_entries frame=coded_picture_number,pkt_pts_time -of csv=p=0
ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[rtsp @ 0x55a9ab5f9880] Missing PPS in sprop-parameter-sets, ignoring
[rtsp @ 0x55a9ab5f9880] RTP H.264 NAL unit type 26 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x55a9ab5ffd80] concealing 6397 DC, 6397 AC, 6397 MV errors in I frame
[h264 @ 0x55a9ab5ffd80] Invalid NAL unit 0, skipping.
[h264 @ 0x55a9ab5ffd80] cabac decode of qscale diff failed at 91 53
[h264 @ 0x55a9ab5ffd80] error while decoding MB 91 53, bytestream 947
[h264 @ 0x55a9ab5ffd80] concealing 7158 DC, 7158 AC, 7158 MV errors in P frame
[rtsp @ 0x55a9ab5f9880] Error parsing AU headers
[h264 @ 0x55a9ab5ffd80] SEI type 100 size 552 truncated at 328
[h264 @ 0x55a9ab5ffd80] Invalid NAL unit 0, skipping.
[h264 @ 0x55a9ab5ffd80] cabac decode of qscale diff failed at 20 37
[h264 @ 0x55a9ab5ffd80] error while decoding MB 20 37, bytestream 1256
[h264 @ 0x55a9ab5ffd80] concealing 8765 DC, 8765 AC, 8765 MV errors in P frame
[h264 @ 0x55a9ab5ffd80] sps_id 32 out of range
[h264 @ 0x55a9ab5ffd80] Invalid NAL unit 0, skipping.
[rtsp @ 0x55a9ab5f9880] RTP H.264 NAL unit type 29 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Input #0, rtsp, from 'rtsp://XXXX:XXXXX@citofono:554/Streaming/Channels/101':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1536x2048, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
[h264 @ 0x55a9ab6197c0] concealing 6397 DC, 6397 AC, 6397 MV errors in I frame
0
2
3
[h264 @ 0x55a9ab6197c0] Invalid NAL unit 0, skipping.
[h264 @ 0x55a9ab6197c0] cabac decode of qscale diff failed at 91 53
[h264 @ 0x55a9ab6197c0] error while decoding MB 91 53, bytestream 947
[h264 @ 0x55a9ab6197c0] concealing 7158 DC, 7158 AC, 7158 MV errors in P frame
4
[h264 @ 0x55a9ab6197c0] Invalid NAL unit 0, skipping.
[h264 @ 0x55a9ab6197c0] cabac decode of qscale diff failed at 20 37
[h264 @ 0x55a9ab6197c0] error while decoding MB 20 37, bytestream 1256
[h264 @ 0x55a9ab6197c0] concealing 8765 DC, 8765 AC, 8765 MV errors in P frame
6
[h264 @ 0x55a9ab6197c0] Invalid NAL unit 0, skipping.
9
10
11
12
    Last message repeated 1 times
[h264 @ 0x55a9ab6197c0] error while decoding MB 11 74, bytestream -6
[h264 @ 0x55a9ab6197c0] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x55a9ab6197c0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x55a9ab6197c0] concealing 5222 DC, 5222 AC, 5222 MV errors in P frame
13
[h264 @ 0x55a9ab6197c0] slice type 13 too large at 4
[h264 @ 0x55a9ab6197c0] decode_slice_header error
[h264 @ 0x55a9ab6197c0] concealing 7283 DC, 7283 AC, 7283 MV errors in P frame

Frigate stats

{"citofono":{"camera_fps":10.5,"capture_pid":225,"detection_fps":0.0,"pid":222,"process_fps":10.5,"skipped_fps":0.0},"detection_fps":0.0,"detectors":{"coral":{"detection_start":0.0,"inference_speed":22.51,"pid":215}},"living":{"camera_fps":5.1,"capture_pid":228,"detection_fps":0.0,"pid":223,"process_fps":5.1,"skipped_fps":0.0},"service":{"latest_version":"0.10.1","storage":{"/dev/shm":{"free":264.3,"mount_type":"tmpfs","total":268.4,"used":4.1},"/media/frigate/clips":{"free":1262366.2,"mount_type":"nfs4","total":23880421.1,"used":22617933.2},"/media/frigate/recordings":{"free":1262366.2,"mount_type":"nfs4","total":23880421.1,"used":22617933.2},"/tmp/cache":{"free":999.6,"mount_type":"tmpfs","total":1000.0,"used":0.4}},"temperatures":{},"uptime":1926,"version":"0.11.0-c461c9e"}}

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wireless

Camera make and model

Hikvision DS-HD1

Any other information that may be helpful

No response

NickM-27 commented 2 years ago

Looks like the RTMP module is not happy with that particular camera and its data, If you disable RTMP it would likely fix the issue.

alexdelprete commented 2 years ago

Disabled RTMP:

[2022-09-06 21:13:54] watchdog.citofono ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : [rtsp @ 0x5575a6167d00] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : [rtsp @ 0x5575a6167d00] DTS discontinuity in stream 1: packet 46 with DTS 26599865889061, packet 47 with DTS 26599865961024
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : [rtsp @ 0x5575a6167d00] DTS discontinuity in stream 1: packet 48 with DTS 26599865961025, packet 49 with DTS 26599865984709
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : [AVHWFramesContext @ 0x7fe55004bd40] Failed to sync surface 0x18: 23 (internal decoding error).
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : [h264 @ 0x5575a6182f40] Failed to transfer data to output frame: -5.
[2022-09-06 21:13:54] ffmpeg.citofono.detect ERROR : Error while processing the decoded data for stream #0:0
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] nal size exceeds length: 26337 1445
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] Invalid NAL unit 0, skipping.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : Last message repeated 4 times
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] RTP H.264 NAL unit type 26 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] Invalid NAL unit 0, skipping.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : Last message repeated 1 times
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] A non-intra slice in an IDR NAL unit.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] decode_slice_header error
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] no frame!
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] RTP H.264 NAL unit type 29 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] RTP H.264 NAL unit type 29 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] RTP H.264 NAL unit type 26 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] RTP H.264 NAL unit type 27 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] Error parsing AU headers
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [rtsp @ 0x55eb079e7ec0] nal size exceeds length: 33400 1445
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] sps_id 9 out of range
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [h264 @ 0x55eb079ee980] missing picture in access unit with size 232
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [segment @ 0x55eb07a07600] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2022-09-06 21:14:14] ffmpeg.citofono.record ERROR : [segment @ 0x55eb07a07600] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[2022-09-06 21:14:14] watchdog.citofono INFO : Terminating the existing ffmpeg process...
[2022-09-06 21:14:14] watchdog.citofono INFO : Waiting for ffmpeg to exit gracefully...
[2022-09-06 21:14:34] ffmpeg.citofono.record ERROR : [rtsp @ 0x55ec3de68ec0] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-06 21:14:34] ffmpeg.citofono.record ERROR : [rtsp @ 0x55ec3de68ec0] Error parsing AU headers
[2022-09-06 21:14:34] ffmpeg.citofono.record ERROR : [segment @ 0x55ec3df9da00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2022-09-06 21:14:34] ffmpeg.citofono.record ERROR : [segment @ 0x55ec3df9da00] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[2022-09-06 21:14:34] ffmpeg.citofono.record ERROR : [segment @ 0x55ec3df9da00] Non-monotonous DTS in output stream 0:0; previous: 848, current: 848; changing to 849. This may result in incorrect timestamps in the output file.
[2022-09-06 21:14:34] watchdog.citofono INFO : Terminating the existing ffmpeg process...
[2022-09-06 21:14:34] watchdog.citofono INFO : Waiting for ffmpeg to exit gracefully...
blakeblackshear commented 2 years ago

Can you post the full ffmpeg command for the record process from the debug page? For some reason this newer version of ffmpeg isn't liking the video feed. In the past, the Error parsing AU headers message has been audio related.

alexdelprete commented 2 years ago

Can you post the full ffmpeg command for the record process from the debug page?

here it is:

"ffmpeg_cmds": [
  {
    "cmd": "ffmpeg -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_device /dev/dri/renderD129 -hwaccel_output_format yuv420p -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://admin:AFFJIE@citofono.axel.dom:554/Streaming/Channels/101 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/citofono-%Y%m%d%H%M%S.mp4",
    "roles": [
      "record"
    ]
  },

In the past, the Error parsing AU headers message has been audio related.

Should I try disabling the audio on the camera?

NickM-27 commented 2 years ago

It seems audio is already disabled in the command with -an.

You might want to try messing with your cameras settings, see if something like H.264+ or other settings are enabled and see if changing settings around fixes the issue.

alexdelprete commented 2 years ago

It seems audio is already disabled in the command with -an

in recording, yes, but the audio data would be captured in input. can I use -an in input? I was thinking to disable it completely on the camera just to see if it creates issues.

You might want to try messing with your cameras settings, see if something like H.264+ or other settings are enabled and see if changing settings around fixes the issue.

There's no H264+ in the settings, just plain H.264. I can play around with I frames etc. but I don't think it's a camera issue, previous versions of frigate were working ok. I know this one has a newer ffmpeg, but it should be compatible with "standard" h.264 streams, I hope...:)

image image

NickM-27 commented 2 years ago

I mean it can't hurt to disable the cameras audio and see what happens. We use a new ffmpeg version because it has better compatibility with cameras and hardware accleration.

Iframe rate generally should be the same as the fps. Might also be worth trying constant bit rate instead of variable bit rate.

alexdelprete commented 2 years ago

Switched to CBR, disabled audio, reduced framerate to 22fps on the main stream. Same errors:

image

[2022-09-07 20:07:55] ffmpeg.citofono.detect ERROR : [rtsp @ 0x556656677d00] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-07 20:07:55] ffmpeg.citofono.detect ERROR : [AVHWFramesContext @ 0x7fb26404be00] Failed to sync surface 0x18: 23 (internal decoding error).
[2022-09-07 20:07:55] ffmpeg.citofono.detect ERROR : [h264 @ 0x556656697040] Failed to transfer data to output frame: -5.
[2022-09-07 20:07:55] ffmpeg.citofono.detect ERROR : Error while processing the decoded data for stream #0:0
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [rtsp @ 0x5560f0ff7ec0] Missing PPS in sprop-parameter-sets, ignoring
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [h264 @ 0x5560f0ffe900] cabac decode of qscale diff failed at 64 55
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [h264 @ 0x5560f0ffe900] error while decoding MB 64 55, bytestream 655
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [h264 @ 0x5560f0ffe900] missing picture in access unit with size 1452
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [h264 @ 0x5560f0ffe900] Invalid NAL unit 0, skipping.
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [h264 @ 0x5560f0ffe900] no frame!
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [segment @ 0x5560f100fb80] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2022-09-07 20:07:55] ffmpeg.citofono.record ERROR : [segment @ 0x5560f100fb80] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
[2022-09-07 20:07:55] watchdog.citofono INFO : Terminating the existing ffmpeg process...
[2022-09-07 20:07:55] watchdog.citofono INFO : Waiting for ffmpeg to exit gracefully...
NickM-27 commented 2 years ago

@alexdelprete Maybe try following https://github.com/blakeblackshear/frigate/pull/3771 to use a different ffmpeg version and see if that fixes it for you?

alexdelprete commented 2 years ago

use a different ffmpeg version and see if that fixes it for you?

the debian/ubuntu builds are ok? what is the docker image based on?

NickM-27 commented 2 years ago

We uses https://github.com/BtbN/FFmpeg-Builds/releases

I would say might as well try your built in ffmpeg first and see how it works

alexdelprete commented 2 years ago

I also found this one, link from the official ffmpeg repo: https://johnvansickle.com/ffmpeg/

Anyway, I solved the problem: it was an issue with the GPU passthrough to the container. When upgrading proxmox probably the kernel upgrades created some issues. I reinstalled the drivers and double-checked vainfo in the docker VM to make sure VAAPI was working:

libva info: VA-API version 1.15.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_8
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.15 (libva 2.12.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointStats
      VAProfileH264Main               : VAEntrypointStats
      VAProfileH264High               : VAEntrypointStats
      VAProfileNone                   : VAEntrypointVideoProc

The really strange thing is that I remember I was using the iHD intel driver, but now the i965 is the only one working. I'll dig into that when I have time, but for now, frigate is happy and the log is perfectly clean with the latest 0.11rc2. :)

[2022-09-08 03:02:11] frigate.app                    INFO    : Starting Frigate (0.11.0-c461c9e)
Starting migrations
[2022-09-08 03:02:12] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-09-08 03:02:12] peewee_migrate                 INFO    : There is nothing to migrate
[2022-09-08 03:02:12] detector.coral                 INFO    : Starting detection process: 217
[2022-09-08 03:02:12] frigate.edgetpu                INFO    : Attempting to load TPU as usb
[2022-09-08 03:02:12] ws4py                          INFO    : Using epoll
[2022-09-08 03:02:12] frigate.app                    INFO    : Output process started: 219
[2022-09-08 03:02:12] frigate.app                    INFO    : Camera processor started for citofono: 224
[2022-09-08 03:02:12] frigate.app                    INFO    : Camera processor started for living: 227
[2022-09-08 03:02:12] frigate.app                    INFO    : Capture process started for citofono: 230
[2022-09-08 03:02:12] frigate.app                    INFO    : Capture process started for living: 233
[2022-09-08 03:02:13] ws4py                          INFO    : Using epoll
[2022-09-08 03:02:15] frigate.edgetpu                INFO    : TPU found
NickM-27 commented 2 years ago

Great and thanks for updating! Glad it is working. That will be good to keep in mind in the future as well. I'll go ahead and close this then.

alexdelprete commented 2 years ago

Last thing: I made the custom ffmpeg "working" with the other repo linked above, but you should update docs to specify that the bins have to be under the bin folder, otherwise frigate doesn't pick them up because it's expecting the same structure as the BtbN one.

Thanks for the support. :)

NickM-27 commented 2 years ago

Last thing: I made the custom ffmpeg "working" with the other repo linked above, but you should update docs to specify that the bins have to be under the bin folder, otherwise frigate doesn't pick them up because it's expecting the same structure as the BtbN one.

Thanks for the support. :)

Thanks, I'll add a note about that.