blakeblackshear / frigate

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

[Support]: RTSP stream changes constantly #4473

Closed gnlgrim closed 1 year ago

gnlgrim commented 1 year ago

Describe the problem you are having

Good day So I have been using Frigate for a while now as a standalone docker container installation and i am not having any issues The only issue I have is with one specific camera that keeps changing its rtsp url ( its a onvif camera ) it will randomly change from rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_IFZLBVWVHYEZ to rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_VRHWZMSJPXLQ and so on. I then have to re-edit the config. This lead me to also use Agent DVR as their config auto adapts to the change and its only for that camera Is this something you can implement or is their a deferent way i can input the onvif rtsp stream or should i just get another camera that doesnt change its streaming url

Version

DEBUG 0.11.1-2EADA21

Frigate config file

{
  "birdseye": {
    "enabled": true,
    "height": 720,
    "mode": "objects",
    "quality": 8,
    "width": 1280
  },
  "cameras": {
    "Dog_Test_cam": {
      "best_image_timeout": 60,
      "birdseye": {
        "enabled": true,
        "mode": "objects"
      },
      "detect": {
        "enabled": false,
        "fps": 5,
        "height": 1080,
        "max_disappeared": 25,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 50
        },
        "width": 1920
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-timeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_FOWKCHTNGOSK",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": [
            "-f",
            "segment",
            "-segment_time",
            "10",
            "-segment_format",
            "mp4",
            "-reset_timestamps",
            "1",
            "-strftime",
            "1",
            "-c",
            "copy",
            "-an"
          ],
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_FOWKCHTNGOSK -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/Dog_Test_cam-%Y%m%d%H%M%S.mp4 -r 5 -s 1920x1080 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "improve_contrast": false,
        "mask": "",
        "mqtt_off_delay": 30,
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "Dog_Test_cam",
      "objects": {
        "filters": {
          "cat": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "fox": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "person": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "",
        "track": [
          "person",
          "cat",
          "dog",
          "fox"
        ]
      },
      "record": {
        "enabled": false,
        "events": {
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [],
          "retain": {
            "default": 10,
            "mode": "motion",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 14,
          "mode": "all"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": false,
        "height": null,
        "quality": 70,
        "required_zones": [],
        "retain": {
          "default": 10,
          "mode": "motion",
          "objects": {}
        },
        "timestamp": true
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "ui": {
        "dashboard": true,
        "order": 0
      },
      "zones": {}
    },
    "Front_Camera": {
      "best_image_timeout": 60,
      "birdseye": {
        "enabled": true,
        "mode": "objects"
      },
      "detect": {
        "enabled": true,
        "fps": 5,
        "height": 1080,
        "max_disappeared": 25,
        "stationary": {
          "interval": 0,
          "max_frames": {
            "default": null,
            "objects": {}
          },
          "threshold": 50
        },
        "width": 1920
      },
      "ffmpeg": {
        "global_args": [
          "-hide_banner",
          "-loglevel",
          "warning"
        ],
        "hwaccel_args": [],
        "input_args": [
          "-avoid_negative_ts",
          "make_zero",
          "-fflags",
          "+genpts+discardcorrupt",
          "-rtsp_transport",
          "tcp",
          "-timeout",
          "5000000",
          "-use_wallclock_as_timestamps",
          "1"
        ],
        "inputs": [
          {
            "global_args": [],
            "hwaccel_args": [],
            "input_args": [],
            "path": "rtsp://192.168.1.245:554/11",
            "roles": [
              "record",
              "rtmp",
              "detect"
            ]
          }
        ],
        "output_args": {
          "detect": [
            "-f",
            "rawvideo",
            "-pix_fmt",
            "yuv420p"
          ],
          "record": "-f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac",
          "rtmp": [
            "-c",
            "copy",
            "-f",
            "flv"
          ]
        }
      },
      "ffmpeg_cmds": [
        {
          "cmd": "ffmpeg -hide_banner -loglevel warning -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://192.168.1.245:554/11 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v copy -c:a aac /tmp/cache/Front_Camera-%Y%m%d%H%M%S.mp4 -r 5 -s 1920x1080 -f rawvideo -pix_fmt yuv420p pipe:",
          "roles": [
            "record",
            "rtmp",
            "detect"
          ]
        }
      ],
      "live": {
        "height": 720,
        "quality": 8
      },
      "motion": {
        "contour_area": 30,
        "delta_alpha": 0.2,
        "frame_alpha": 0.2,
        "frame_height": 50,
        "improve_contrast": false,
        "mask": [
          "343,256,342,342,380,386,551,439,810,503,1191,595,1269,492,1356,355,1423,218,1466,123,1471,0,1325,0,867,0,485,0"
        ],
        "mqtt_off_delay": 30,
        "threshold": 25
      },
      "mqtt": {
        "bounding_box": true,
        "crop": true,
        "enabled": true,
        "height": 270,
        "quality": 70,
        "required_zones": [],
        "timestamp": true
      },
      "name": "Front_Camera",
      "objects": {
        "filters": {
          "backpack": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "cat": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "dog": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "fox": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          },
          "person": {
            "mask": null,
            "max_area": 24000000,
            "max_ratio": 24000000,
            "min_area": 0,
            "min_ratio": 0,
            "min_score": 0.5,
            "threshold": 0.7
          }
        },
        "mask": "",
        "track": [
          "person",
          "cat",
          "dog",
          "backpack",
          "fox"
        ]
      },
      "record": {
        "enabled": true,
        "events": {
          "objects": null,
          "post_capture": 5,
          "pre_capture": 5,
          "required_zones": [
            "front_yard"
          ],
          "retain": {
            "default": 10,
            "mode": "motion",
            "objects": {}
          }
        },
        "expire_interval": 60,
        "retain": {
          "days": 14,
          "mode": "all"
        },
        "retain_days": null
      },
      "rtmp": {
        "enabled": false
      },
      "snapshots": {
        "bounding_box": true,
        "clean_copy": true,
        "crop": false,
        "enabled": true,
        "height": null,
        "quality": 70,
        "required_zones": [
          "front_yard"
        ],
        "retain": {
          "default": 10,
          "mode": "motion",
          "objects": {}
        },
        "timestamp": true
      },
      "timestamp_style": {
        "color": {
          "blue": 255,
          "green": 255,
          "red": 255
        },
        "effect": null,
        "format": "%m/%d/%Y %H:%M:%S",
        "position": "tl",
        "thickness": 2
      },
      "ui": {
        "dashboard": true,
        "order": 0
      },
      "zones": {
        "front_yard": {
          "coordinates": "935,1080,1604,1080,1678,950,1727,725,1770,29,1315,0,1241,79,1310,373,1148,694,915,649,459,504,277,404,309,277,535,0,113,0,0,0,0,624,0,1080,503,1080",
          "filters": {},
          "objects": [
            "person",
            "cat",
            "dog",
            "backpack",
            "fox"
          ]
        }
      }
    }
  },
  "database": {
    "path": "/media/frigate/frigate.db"
  },
  "detect": {
    "enabled": true,
    "fps": 5,
    "height": 720,
    "max_disappeared": null,
    "stationary": {
      "interval": 0,
      "max_frames": {
        "default": null,
        "objects": {}
      },
      "threshold": null
    },
    "width": 1280
  },
  "detectors": {
    "cpu1": {
      "device": "usb",
      "num_threads": 3,
      "type": "cpu"
    },
    "cpu2": {
      "device": "usb",
      "num_threads": 3,
      "type": "cpu"
    }
  },
  "environment_vars": {},
  "ffmpeg": {
    "global_args": [
      "-hide_banner",
      "-loglevel",
      "warning"
    ],
    "hwaccel_args": [],
    "input_args": [
      "-avoid_negative_ts",
      "make_zero",
      "-fflags",
      "+genpts+discardcorrupt",
      "-rtsp_transport",
      "tcp",
      "-timeout",
      "5000000",
      "-use_wallclock_as_timestamps",
      "1"
    ],
    "output_args": {
      "detect": [
        "-f",
        "rawvideo",
        "-pix_fmt",
        "yuv420p"
      ],
      "record": [
        "-f",
        "segment",
        "-segment_time",
        "10",
        "-segment_format",
        "mp4",
        "-reset_timestamps",
        "1",
        "-strftime",
        "1",
        "-c",
        "copy",
        "-an"
      ],
      "rtmp": [
        "-c",
        "copy",
        "-f",
        "flv"
      ]
    }
  },
  "live": {
    "height": 720,
    "quality": 8
  },
  "logger": {
    "default": "info",
    "logs": {}
  },
  "model": {
    "height": 320,
    "labelmap": {},
    "labelmap_path": null,
    "path": null,
    "width": 320
  },
  "motion": null,
  "mqtt": {
    "client_id": "frigate",
    "host": "192.168.1.113",
    "password": "password",
    "port": 1883,
    "stats_interval": 60,
    "tls_ca_certs": null,
    "tls_client_cert": null,
    "tls_client_key": null,
    "tls_insecure": null,
    "topic_prefix": "frigate",
    "user": "mqtt-user"
  },
  "objects": {
    "filters": null,
    "mask": "",
    "track": [
      "person"
    ]
  },
  "plus": {
    "enabled": false
  },
  "record": {
    "enabled": false,
    "events": {
      "objects": null,
      "post_capture": 5,
      "pre_capture": 5,
      "required_zones": [],
      "retain": {
        "default": 10,
        "mode": "motion",
        "objects": {}
      }
    },
    "expire_interval": 60,
    "retain": {
      "days": 0,
      "mode": "all"
    },
    "retain_days": null
  },
  "rtmp": {
    "enabled": true
  },
  "snapshots": {
    "bounding_box": true,
    "clean_copy": true,
    "crop": false,
    "enabled": false,
    "height": null,
    "quality": 70,
    "required_zones": [],
    "retain": {
      "default": 10,
      "mode": "motion",
      "objects": {}
    },
    "timestamp": false
  },
  "timestamp_style": {
    "color": {
      "blue": 255,
      "green": 255,
      "red": 255
    },
    "effect": null,
    "format": "%m/%d/%Y %H:%M:%S",
    "position": "tl",
    "thickness": 2
  },
  "ui": {
    "use_experimental": false
  }
}

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-11-22 12:41:58] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
Starting migrations
[2022-11-22 12:41:58] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-11-22 12:41:58] peewee_migrate                 INFO    : There is nothing to migrate
[2022-11-22 12:41:58] frigate.app                    INFO    : Output process started: 215
[2022-11-22 12:41:58] frigate.app                    INFO    : Camera processor started for Dog_Test_cam: 218
[2022-11-22 12:41:58] ws4py                          INFO    : Using epoll
[2022-11-22 12:41:58] frigate.app                    INFO    : Camera processor started for Front_Camera: 221
[2022-11-22 12:41:58] frigate.app                    INFO    : Capture process started for Dog_Test_cam: 223
[2022-11-22 12:41:58] frigate.app                    INFO    : Capture process started for Front_Camera: 224
[2022-11-22 12:41:58] frigate.mqtt                   INFO    : Turning off recordings for Dog_Test_cam via mqtt
[2022-11-22 12:41:58] frigate.mqtt                   INFO    : Turning off snapshots for Dog_Test_cam via mqtt
[2022-11-22 12:41:58] frigate.mqtt                   INFO    : Turning off detection for Dog_Test_cam via mqtt
[2022-11-22 12:41:58] detector.cpu1                  INFO    : Starting detection process: 212
[2022-11-22 12:41:58] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-11-22 12:41:58] detector.cpu2                  INFO    : Starting detection process: 214
[2022-11-22 12:41:58] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-11-22 12:41:59] ws4py                          INFO    : Using epoll
[2022-11-22 12:42:00] frigate.video                  ERROR   : Dog_Test_cam: Unable to read frames from ffmpeg process.
[2022-11-22 12:42:00] frigate.video                  ERROR   : Dog_Test_cam: ffmpeg process is not running. exiting capture thread...
[2022-11-22 12:42:18] watchdog.Dog_Test_cam          ERROR   : Ffmpeg process crashed unexpectedly for Dog_Test_cam.
[2022-11-22 12:42:18] watchdog.Dog_Test_cam          ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-11-22 12:42:18] ffmpeg.Dog_Test_cam.detect     ERROR   : rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_FOWKCHTNGOSK: Invalid data found when processing input
[2022-11-22 12:42:19] frigate.video                  ERROR   : Dog_Test_cam: Unable to read frames from ffmpeg process.
[2022-11-22 12:42:19] frigate.video                  ERROR   : Dog_Test_cam: ffmpeg process is not running. exiting capture thread...
[2022-11-22 12:42:28] watchdog.Dog_Test_cam          ERROR   : Ffmpeg process crashed unexpectedly for Dog_Test_cam.
[2022-11-22 12:42:28] watchdog.Dog_Test_cam          ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-11-22 12:42:28] ffmpeg.Dog_Test_cam.detect     ERROR   : rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_FOWKCHTNGOSK: Invalid data found when processing input
[2022-11-22 12:42:29] frigate.video                  ERROR   : Dog_Test_cam: Unable to read frames from ffmpeg process.
[2022-11-22 12:42:29] frigate.video                  ERROR   : Dog_Test_cam: ffmpeg process is not running. exiting capture thread...
[2022-11-22 12:42:38] watchdog.Dog_Test_cam          ERROR   : Ffmpeg process crashed unexpectedly for Dog_Test_cam.
[2022-11-22 12:42:38] watchdog.Dog_Test_cam          ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-11-22 12:42:38] ffmpeg.Dog_Test_cam.detect     ERROR   : rtsp://192.168.1.115:554/live/1jfiegbrorvlq_p0_FOWKCHTNGOSK: Invalid data found when processing input
[2022-11-22 12:42:38] frigate.video                  ERROR   : Dog_Test_cam: Unable to read frames from ffmpeg process.
[2022-11-22 12:42:38] frigate.video                  ERROR   : Dog_Test_cam: ffmpeg process is not running. exiting capture thread...

FFprobe output from your camera

none

Frigate stats

No response

Operating system

Proxmox

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

conico onvif

Any other information that may be helpful

No response

gnlgrim commented 1 year ago

C

gnlgrim commented 1 year ago

Can someone please give me a response

blakeblackshear commented 1 year ago

How do you configure it with AgentDVR? I'm guessing you don't give it the rtsp url.

gnlgrim commented 1 year ago

When you scan for a camera.. it automatically graps the rtsp url from the available sources. You are able to choose hi or low res rtsp stream.... If that url updates it auto changes it in the config

blakeblackshear commented 1 year ago

It might be possible to put some kind of service in front of frigate that handles this and can provide a consistent stream url to frigate. There is no functionality in frigate for this.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.