blakeblackshear / frigate

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

Over 3 RTMP streams gives libavformat error #1811

Closed Morphy99 closed 3 years ago

Morphy99 commented 3 years ago

Describe the bug Trying to set up Frigate with 4x RTMP streams but whenever I add the fourth I get this error:

ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x55ce9d04e3c0] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x55ce9d04e3c0] Server error: Already publishing
ffmpeg.side rear.detect        ERROR   : rtmp://127.0.0.1/live/side rear: Operation not permitted

With 3 x cameras works OK. Tried lower resolution streams to no effect. Version of frigate 0.8.4-5043040

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

mqtt:
  # Required: host name
  host: 192.168.0.119 #core-mosquitto 
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: xxxx
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: xxxxxx
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
database:
  path: /config/frigate.db
detectors:
#  coral_usb:
#    type: edgetpu
#    device: usb
  coral_pci:
    type: edgetpu
    device: pci

objects:
  track:
    - person
    - car
  filters:
    person:
      threshold: 0.7

###############################################################front########################################################################

cameras:
  front:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.0.115/bcs/channel0_main.bcs?channel=0&stream=0&user=xxxx&password=xxxx
          roles:
            - detect
            - clips
            - rtmp
      hwaccel_args:
        - -hwaccel_output_format
        - yuv420p
      input_args:
        - -avoid_negative_ts
        - make_zero
    width: 2560
    height: 1920
    fps: 5
    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 5
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 10
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - person
        - car        
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones:
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 20
        # Optional: Per object retention days
#        objects:
#          person: 15
    # Optional: Configuration for the jpg snapshots written to the clips directory for each event
    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: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: True
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: original size)
    #  height: 175
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones: 
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 15
        # Optional: Per object retention days
#        objects:
#          person: 15
    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: True
      # Optional: crop the snapshot (default: shown below)
      crop: True
      # Optional: height to resize the snapshot to (default: shown below)
      height: 270
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: 
        - drive
        - path
#    motion:
#      mask:
#        - 0,80,780,79,795,0,0,0
#    zones:
#      front_drive:
#        coordinates: 139,1295,859,1349,1629,1307,1305,546,513,564
#      front_path:
#        coordinates: 1830,1536,2048,1536,2048,1102,1701,515,1430,650
#    objects:
#      track:
#        - person
#        - car
#      filters:
#        car:
#          mask:
#            - 640,0,640,99,538,90,369,80,200,83,109,96,0,123,0,0
#            - 316,111,640,128,640,480,0,480,0,139
#        person:
#          min_area: 980
    detect:
   # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
      max_disappeared: 100

###############################################################rear########################################################################

  rear:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.0.116/bcs/channel0_main.bcs?channel=0&stream=0&user=xxxx&password=xxxx
          roles:
            - detect
            - clips
            - rtmp
      hwaccel_args:
        - -hwaccel_output_format
        - yuv420p
      input_args:
        - -avoid_negative_ts
        - make_zero
    width: 2560
    height: 1920
    fps: 5
    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 5
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 10
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - person
        - car        
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones:
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 20
        # Optional: Per object retention days
#        objects:
#          person: 15
    # Optional: Configuration for the jpg snapshots written to the clips directory for each event
    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: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: True
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: original size)
    #  height: 175
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones: 
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 15
        # Optional: Per object retention days
#        objects:
#          person: 15
    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: True
      # Optional: crop the snapshot (default: shown below)
      crop: True
      # Optional: height to resize the snapshot to (default: shown below)
      height: 270
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: 
        - drive
        - path
#    motion:
#      mask:
#        - 0,80,780,79,795,0,0,0
#    zones:
#      front_drive:
#        coordinates: 139,1295,859,1349,1629,1307,1305,546,513,564
#      front_path:
#        coordinates: 1830,1536,2048,1536,2048,1102,1701,515,1430,650
#    objects:
#      track:
#        - person
#        - car
#      filters:
#        car:
#          mask:
#            - 640,0,640,99,538,90,369,80,200,83,109,96,0,123,0,0
#            - 316,111,640,128,640,480,0,480,0,139
#        person:
#          min_area: 980
    detect:
   # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
      max_disappeared: 100

###############################################################side front########################################################################

  side front:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.0.117/bcs/channel0_main.bcs?channel=0&stream=0&user=xxxx&password=xxxx
          roles:
            - detect
            - clips
            - rtmp
      hwaccel_args:
        - -hwaccel_output_format
        - yuv420p
      input_args:
        - -avoid_negative_ts
        - make_zero
    width: 2560
    height: 1920
    fps: 5
    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 5
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 10
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - person
        - car        
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones:
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 20
        # Optional: Per object retention days
#        objects:
#          person: 15
    # Optional: Configuration for the jpg snapshots written to the clips directory for each event
    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: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: True
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: original size)
    #  height: 175
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones: 
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 15
        # Optional: Per object retention days
#        objects:
#          person: 15
    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: True
      # Optional: crop the snapshot (default: shown below)
      crop: True
      # Optional: height to resize the snapshot to (default: shown below)
      height: 270
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: 
        - drive
        - path
#    motion:
#      mask:
#        - 0,80,780,79,795,0,0,0
#    zones:
#      front_drive:
#        coordinates: 139,1295,859,1349,1629,1307,1305,546,513,564
#      front_path:
#        coordinates: 1830,1536,2048,1536,2048,1102,1701,515,1430,650
#    objects:
#      track:
#        - person
#        - car
#      filters:
#        car:
#          mask:
#            - 640,0,640,99,538,90,369,80,200,83,109,96,0,123,0,0
#            - 316,111,640,128,640,480,0,480,0,139
#        person:
#          min_area: 980
    detect:
   # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
      max_disappeared: 100

###############################################################side rear########################################################################

  side rear:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.0.118/bcs/channel0_main.bcs?channel=0&stream=0&user=xxxx&password=xxxx
          roles:
            - detect
            - clips
            - rtmp
      hwaccel_args:
        - -hwaccel_output_format
        - yuv420p
      input_args:
        - -avoid_negative_ts
        - make_zero
    width: 2560
    height: 1920
    fps: 5
    clips:
      # Required: enables clips for the camera (default: shown below)
      # This value can be set via MQTT and will be updated in startup based on retained value
      enabled: True
      # Optional: Number of seconds before the event to include in the clips (default: shown below)
      pre_capture: 5
      # Optional: Number of seconds after the event to include in the clips (default: shown below)
      post_capture: 10
      # Optional: Objects to save clips for. (default: all tracked objects)
      objects:
        - person
        - car        
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones:
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 20
        # Optional: Per object retention days
#        objects:
#          person: 15
    # Optional: Configuration for the jpg snapshots written to the clips directory for each event
    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: print a timestamp on the snapshots (default: shown below)
      timestamp: False
      # Optional: draw bounding box on the snapshots (default: shown below)
      bounding_box: True
      # Optional: crop the snapshot (default: shown below)
      crop: False
      # Optional: height to resize the snapshot to (default: original size)
    #  height: 175
      # Optional: Restrict clips to objects that entered any of the listed zones (default: no required zones)
#      required_zones: 
#        - drive
#        - path
      # Optional: Camera override for retention settings (default: global values)
      retain:
        # Required: Default retention days (default: shown below)
        default: 15
        # Optional: Per object retention days
#        objects:
#          person: 15
    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: True
      # Optional: crop the snapshot (default: shown below)
      crop: True
      # Optional: height to resize the snapshot to (default: shown below)
      height: 270
      # Optional: Restrict mqtt messages to objects that entered any of the listed zones (default: no required zones)
      required_zones: 
        - drive
        - path
#    motion:
#      mask:
#        - 0,80,780,79,795,0,0,0
#    zones:
#      front_drive:
#        coordinates: 139,1295,859,1349,1629,1307,1305,546,513,564
#      front_path:
#        coordinates: 1830,1536,2048,1536,2048,1102,1701,515,1430,650
#    objects:
#      track:
#        - person
#        - car
#      filters:
#        car:
#          mask:
#            - 640,0,640,99,538,90,369,80,200,83,109,96,0,123,0,0
#            - 316,111,640,128,640,480,0,480,0,139
#        person:
#          min_area: 980
    detect:
   # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
      max_disappeared: 100

Frigate container logs

 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
peewee_migrate                 INFO    : There is nothing to migrate
frigate.mqtt                   INFO    : MQTT connected
frigate.app                    INFO    : Camera processor started for front: 33
frigate.app                    INFO    : Camera processor started for rear: 35
frigate.app                    INFO    : Camera processor started for side front: 36
frigate.app                    INFO    : Camera processor started for side rear: 38
detector.coral_pci             INFO    : Starting detection process: 29
frigate.edgetpu                INFO    : Attempting to load TPU as pci
frigate.edgetpu                INFO    : TPU found
frigate.app                    INFO    : Capture process started for front: 49
frigate.app                    INFO    : Capture process started for rear: 51
frigate.app                    INFO    : Capture process started for side front: 53
frigate.app                    INFO    : Capture process started for side rear: 54
frigate.video                  INFO    : side rear: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : side rear: ffmpeg process is not running. exiting capture thread...
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x55a59d5ad580] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x55a59d5ad580] Server error: Already publishing
ffmpeg.side rear.detect        ERROR   : rtmp://127.0.0.1/live/side rear: Operation not permitted
frigate.http                   DEBUG   : Received mqtt message on frigate/stats.
frigate.video                  INFO    : side rear: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : side rear: ffmpeg process is not running. exiting capture thread...
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x557b0812c280] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x557b0812c280] Server error: Already publishing
ffmpeg.side rear.detect        ERROR   : rtmp://127.0.0.1/live/side rear: Operation not permitted
Argument 'front-20210924125727.mp4' provided as input filename, but '/tmp/cache/side' was already specified.
frigate.events                 INFO    : bad file: side front-20210924125727.mp4
frigate.video                  INFO    : side rear: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : side rear: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : side rear: ffmpeg process is not running. exiting capture thread...
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x560fbc6ee9c0] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x560fbc6ee9c0] Server error: Already publishing
ffmpeg.side rear.detect        ERROR   : rtmp://127.0.0.1/live/side rear: Operation not permitted
Argument 'front-20210924125734.mp4' provided as input filename, but '/tmp/cache/side' was already specified.
frigate.events                 INFO    : bad file: side front-20210924125734.mp4
frigate.app                    INFO    : Stopping...
frigate.object_processing      INFO    : Exiting object processor...
frigate.video                  INFO    : side rear: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video                  INFO    : side rear: ffmpeg process is not running. exiting capture thread...
frigate.events                 INFO    : Exiting event cleanup...
frigate.record                 INFO    : Exiting recording maintenance...
frigate.watchdog               INFO    : Exiting watchdog...
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x557e55f84540] Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.
ffmpeg.side rear.detect        ERROR   : [rtmp @ 0x557e55f84540] Server error: Already publishing
ffmpeg.side rear.detect        ERROR   : rtmp://127.0.0.1/live/side rear: Operation not permitted
frigate.events                 INFO    : Exiting event processor...

Frigate stats

<html><body>
<!--StartFragment--><div id="content"><div class="tabs "><nav class="tabs-navigation"><ul class="tabs-menu" role="tablist"><li class="tabs-menu-item json is-active" role="presentation"><span class="devtools-tab-line"></span></li></ul></nav></div></div><span class="devtools-tab-line"></span><span class="devtools-tab-line"></span><div id="json-panel" style="visibility: visible; height: 100%;" class="tab-panel-box" role="tabpanel" aria-labelledby="json-tab"><div class="tab-panel json"><div class="jsonPanelBox tab-panel-inner"><div class="toolbar"></div></div></div></div><div id="json-panel" style="visibility: visible; height: 100%;" class="tab-panel-box" role="tabpanel" aria-labelledby="json-tab"><div class="tab-panel json"><div class="jsonPanelBox tab-panel-inner"><div class="toolbar"><div class="devtools-separator"></div><input class="searchBox devtools-filterinput" placeholder="Filter JSON"></div><div class="panelContent">

  |  
-- | --
detection_fps | 4.7
detectors |  
coral_pci |  
detection_start | 0
inference_speed | 10
pid | 29
front |  
camera_fps | 5.1
capture_pid | 38
detection_fps | 1.1
pid | 32
process_fps | 5.1
skipped_fps | 0
rear |  
camera_fps | 5
capture_pid | 39
detection_fps | 1.7
pid | 33
process_fps | 5
skipped_fps | 0
service |  
storage |  
/dev/shm |  
free | 204.5
mount_type | "tmpfs"
total | 220.2
used | 15.7
/media/frigate/clips |  
free | 413168.6
mount_type | "ext4"
total | 435444.5
used | 85.2
/media/frigate/recordings |  
free | 413168.6
mount_type | "ext4"
total | 435444.5
used | 85.2
/tmp/cache |  
free | 979.8
mount_type | "tmpfs"
total | 1000
used | 20.2
uptime | 33
version | "0.8.4-5043040"
side front |  
camera_fps | 0
capture_pid | 41
detection_fps | 0
pid | 35
process_fps | 0
skipped_fps | 0
side rear |  
camera_fps | 5.1
capture_pid | 43
detection_fps | 1.9
pid | 36
process_fps | 5.1
skipped_fps | 0

</div></div></div></div><!--EndFragment-->
</body>
</html>

FFprobe from your camera

Run the following command and paste output below

ffprobe <stream_url>

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

Computer Hardware

Camera Info:

Additional context Add any other context about the problem here.

Morphy99 commented 3 years ago

Added logs and api stats

blakeblackshear commented 3 years ago

I think this is because you have a space in your camera names. Try using underscores instead of spaces like "side_rear".

Morphy99 commented 3 years ago

OMG you're right. Bizarre how it worked with three cameras including one with a space in the name though! Thanks so much.