Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Support]: Camera feeds keep crashing #7642

Closed
Maxxell opened this issue Aug 31, 2023 · 97 comments
Closed

[Support]: Camera feeds keep crashing #7642

Maxxell opened this issue Aug 31, 2023 · 97 comments

Comments

@Maxxell
Copy link

Maxxell commented Aug 31, 2023

Describe the problem you are having

I have had frigate for a while. It started intermittently losing connection to my cameras. I upgraded to latest version, which included upgrading all my HomeAssistant Notifications. Now that I am on the latest version, I am still having intermittent issues where one (or more) of my cameras start showing "no frames have been received, check error logs"

Rightnow its affecting only 1 of my cameras. But it does sometimes affect others. Logs below reflect current state, where only the "Frontdoor" camera is offline.

Version

0.12.1-367D724

Frigate config file

mqtt:
  host: 192.168.4.81
  port: 1883
  user: 
  password: 
detectors:
  coral:
    type: edgetpu
    device: usb
birdseye: 
  enabled: True
  mode: continuous
cameras:
  REDACTED:
    ffmpeg:
      hwaccel_args: -c:v h264_cuvid
      inputs:
        - path: rtsp:https://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 3
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    detect:
      width: 640
      height: 480
  Backyard:
    ffmpeg:
      hwaccel_args: -c:v h264_cuvid
      inputs:
        - path: rtsp:https://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 4
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    detect:
      width: 640
      height: 480
    motion:
      mask:
        - 0,321,21,293,32,242,85,221,124,197,128,156,144,140,165,137,157,93,120,63,137,38,149,0,0,0
        - 225,0,358,0,350,53,325,62,307,83,267,72,241,66,231,47,229,0
    objects:
      track:
        - person
        - dog      
  REDACTED:
    ffmpeg:
      hwaccel_args: -c:v h264_cuvid
      inputs:
        - path: rtsp:https://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 3
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    motion:
      mask:
        - 0,0,0,379,63,176,74,99,122,0
    detect:
      width: 640
      height: 480
  Frontdoor:
    ffmpeg:
      hwaccel_args: -c:v h264_cuvid
      inputs:
        - path: rtsp:https://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 4
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    detect:
      width: 720
      height: 576
    objects:
      track:
        - person
        - dog
  Garage:
    ffmpeg:
      hwaccel_args: -c:v h264_cuvid
      inputs:
        - path: rtsp:https://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 4
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    detect:
      width: 1280
      height: 720

Relevant log output

Here's what looks relevant to me.

2023-08-30 16:51:04.742161520  [2023-08-30 16:51:04] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:04.742491216  [2023-08-30 16:51:04] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:09.726873377  [2023-08-30 16:51:09] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:09.727454843  [2023-08-30 16:51:09] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:09.727714029  [2023-08-30 16:51:09] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x5597d305d540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: Connection timed out
2023-08-30 16:51:09.728317532  [2023-08-30 16:51:09] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: Connection timed out
2023-08-30 16:51:12.809836361  [2023-08-30 16:51:12] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:12.810162091  [2023-08-30 16:51:12] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:19.755044528  [2023-08-30 16:51:19] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:19.755337704  [2023-08-30 16:51:19] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:19.755588413  [2023-08-30 16:51:19] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x563a1d090540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: No route to host
2023-08-30 16:51:19.755815259  [2023-08-30 16:51:19] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: No route to host
2023-08-30 16:51:24.783033304  [2023-08-30 16:51:24] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:24.783146871  [2023-08-30 16:51:24] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:29.765519222  [2023-08-30 16:51:29] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:29.765769357  [2023-08-30 16:51:29] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:29.765955917  [2023-08-30 16:51:29] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x55c5ad61a540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: Connection timed out
2023-08-30 16:51:29.766172144  [2023-08-30 16:51:29] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: Connection timed out
2023-08-30 16:51:31.671919661  [2023-08-30 16:51:31] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:31.672140085  [2023-08-30 16:51:31] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:39.774300671  [2023-08-30 16:51:39] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:39.774324526  [2023-08-30 16:51:39] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:39.774390231  [2023-08-30 16:51:39] ffmpeg.Frontdoor.detect        ERROR   : [AVHWDeviceContext @ 0x556aa3253e80] cu->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2023-08-30 16:51:39.774403269  [2023-08-30 16:51:39] ffmpeg.Frontdoor.detect        ERROR   : Error while opening decoder for input stream #0:0 : Generic error in an external library
2023-08-30 16:51:41.487462987  [2023-08-30 16:51:41] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:41.487813125  [2023-08-30 16:51:41] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:49.782399265  [2023-08-30 16:51:49] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.

FFprobe output from your camera

For the camera that's currently offline:

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"15/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1920,"width":2560},{"avg_frame_rate":"0/0","bit_rate":"128000","codec_long_name":"PCMmu-law/G.711mu-law"}]}}]

Frigate stats

{
    "Backyard": {
        "camera_fps": 5,
        "capture_pid": 739,
        "detection_enabled": 1,
        "detection_fps": 0.5,
        "ffmpeg_pid": 378677,
        "pid": 729,
        "process_fps": 5.1,
        "skipped_fps": 0
    },
    "Frontdoor": {
        "camera_fps": 0,
        "capture_pid": 747,
        "detection_enabled": 1,
        "detection_fps": 0,
        "ffmpeg_pid": 690852,
        "pid": 732,
        "process_fps": 6.1,
        "skipped_fps": 0
    },
    "Garage": {
        "camera_fps": 5,
        "capture_pid": 755,
        "detection_enabled": 1,
        "detection_fps": 0,
        "ffmpeg_pid": 378639,
        "pid": 734,
        "process_fps": 5,
        "skipped_fps": 0
    },
    "REDACTED": {
        "camera_fps": 5.1,
        "capture_pid": 735,
        "detection_enabled": 1,
        "detection_fps": 0,
        "ffmpeg_pid": 378640,
        "pid": 727,
        "process_fps": 5.1,
        "skipped_fps": 0
    },
    "REDACTED": {
        "camera_fps": 5.1,
        "capture_pid": 744,
        "detection_enabled": 1,
        "detection_fps": 0,
        "ffmpeg_pid": 378641,
        "pid": 731,
        "process_fps": 5.1,
        "skipped_fps": 0
    },
    "cpu_usages": {
        "1": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "15": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "17": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "24": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "25": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "26": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "27": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "28": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "29": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "30": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "31": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "32": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "41": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "42": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "79": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "80": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "82": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "89": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "97": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "98": {
            "cpu": "2.0",
            "mem": "1.2"
        },
        "112": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "134": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "135": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "136": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "137": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "146": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "160": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "191": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "239": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "281": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "320": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "356": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "397": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "430": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "468": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "502": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "532": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "715": {
            "cpu": "0.0",
            "mem": "0.2"
        },
        "721": {
            "cpu": "0.7",
            "mem": "0.0"
        },
        "724": {
            "cpu": "1.0",
            "mem": "0.2"
        },
        "727": {
            "cpu": "0.7",
            "mem": "0.2"
        },
        "728": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "729": {
            "cpu": "0.7",
            "mem": "0.2"
        },
        "730": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "731": {
            "cpu": "0.7",
            "mem": "0.2"
        },
        "732": {
            "cpu": "0.0",
            "mem": "0.2"
        },
        "733": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "734": {
            "cpu": "1.0",
            "mem": "0.3"
        },
        "735": {
            "cpu": "1.0",
            "mem": "0.2"
        },
        "736": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "739": {
            "cpu": "0.7",
            "mem": "0.2"
        },
        "742": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "744": {
            "cpu": "1.0",
            "mem": "0.2"
        },
        "747": {
            "cpu": "0.7",
            "mem": "0.2"
        },
        "750": {
            "cpu": "0.0",
            "mem": "0.1"
        },
        "755": {
            "cpu": "1.7",
            "mem": "0.2"
        },
        "378639": {
            "cpu": "22.0",
            "mem": "0.5"
        },
        "378640": {
            "cpu": "18.3",
            "mem": "0.4"
        },
        "378641": {
            "cpu": "18.7",
            "mem": "0.4"
        },
        "378677": {
            "cpu": "24.7",
            "mem": "0.4"
        },
        "560792": {
            "cpu": "0.0",
            "mem": "0.8"
        },
        "690832": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "690870": {
            "cpu": "0.0",
            "mem": "0.0"
        },
        "%Cpu(s):": {
            "cpu": "id,",
            "mem": "0.0"
        },
        "MiB": {
            "cpu": "28995.2",
            "mem": "avail"
        },
        "PID": {
            "cpu": "%CPU",
            "mem": "%MEM"
        },
        "Tasks:": {
            "cpu": "stopped,",
            "mem": "0"
        },
        "top": {
            "cpu": "users,",
            "mem": "load"
        }
    },
    "detection_fps": 0.5,
    "detectors": {
        "coral": {
            "detection_start": 0,
            "inference_speed": 9.75,
            "pid": 560792
        }
    },
    "gpu_usages": {
        "error-gpu": {
            "gpu": -1,
            "mem": -1
        }
    },
    "service": {
        "last_updated": 1693511264,
        "latest_version": "0.12.1",
        "storage": {
            "/dev/shm": {
                "free": 112.5,
                "mount_type": "tmpfs",
                "total": 134.2,
                "used": 21.7
            },
            "/media/frigate/clips": {
                "free": 337449.5,
                "mount_type": "ext4",
                "total": 982820.9,
                "used": 595371.3
            },
            "/media/frigate/recordings": {
                "free": 337449.5,
                "mount_type": "ext4",
                "total": 982820.9,
                "used": 595371.3
            },
            "/tmp/cache": {
                "free": 983.5,
                "mount_type": "tmpfs",
                "total": 1000,
                "used": 16.5
            }
        },
        "temperatures": {},
        "uptime": 523519,
        "version": "0.12.1-367d724"
    }
}

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Amcrest AD110

Any other information that may be helpful

No response

@NickM-27
Copy link
Sponsor Collaborator

tcp:https://192.168.7.166:554?timeout=5000000 failed: No route to host means the camera is not on the network at that ip address

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023 via email

@NickM-27
Copy link
Sponsor Collaborator

potentially because the camera is struggling to provide multiple streams at once. Ffmpeg makes no mistake on that, it is not seeing the device on the network or the stream is timing out and stops sending data

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

So that error about a CUDA-compatible device is irrelevant?

I only spun up the Synology system after these problems started happening with Frigate. The whole point of using frigate was that I had minimal connections to the camera itself.

@NickM-27
Copy link
Sponsor Collaborator

So that error about a CUDA-compatible device is irrelevant?

it is its own problem, but the logs are clear about the camera

The whole point of using frigate was that I had minimal connections to the camera itself.

you're not using go2rtc, so frigate is not restreaming

in any case, that is irrelevant, I was only offering an example, not saying that was definitely the reason

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

Entirely possible I have multiple issues here.

  1. I dont understand how there is an internet connection issue when other devices can still find the camera at the same location. Is there a way to have frigate 'try again' without manually restarting frigate? That seems the only reliable way to restore these connections.
  2. I dont re-stream through frigate. I have a HomeAssistant page which is a live view through frigate. Perhaps that is not re-streaming, but I thought that would still be going through frigate instead of connecting directly to camera.
  3. How would I investigate the CUDA-related error?

@NickM-27
Copy link
Sponsor Collaborator

I dont understand how there is an internet connection issue when other devices can still find the camera at the same location. Is there a way to have frigate 'try again' without manually restarting frigate? That seems the only reliable way to restore these connections.

frigate is "trying again" hence the repeating logs

2023-08-30 16:51:09.727454843  [2023-08-30 16:51:09] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:09.727714029  [2023-08-30 16:51:09] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x5597d305d540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: Connection timed out
2023-08-30 16:51:09.728317532  [2023-08-30 16:51:09] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: Connection timed out
2023-08-30 16:51:12.809836361  [2023-08-30 16:51:12] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:12.810162091  [2023-08-30 16:51:12] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:19.755044528  [2023-08-30 16:51:19] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:19.755337704  [2023-08-30 16:51:19] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:19.755588413  [2023-08-30 16:51:19] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x563a1d090540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: No route to host
2023-08-30 16:51:19.755815259  [2023-08-30 16:51:19] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: No route to host
2023-08-30 16:51:24.783033304  [2023-08-30 16:51:24] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.
2023-08-30 16:51:24.783146871  [2023-08-30 16:51:24] frigate.video                  ERROR   : Frontdoor: ffmpeg process is not running. exiting capture thread...
2023-08-30 16:51:29.765519222  [2023-08-30 16:51:29] watchdog.Frontdoor             ERROR   : Ffmpeg process crashed unexpectedly for Frontdoor.
2023-08-30 16:51:29.765769357  [2023-08-30 16:51:29] watchdog.Frontdoor             ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-08-30 16:51:29.765955917  [2023-08-30 16:51:29] ffmpeg.Frontdoor.detect        ERROR   : [tcp @ 0x55c5ad61a540] Connection to tcp:https://192.168.7.166:554?timeout=5000000 failed: Connection timed out
2023-08-30 16:51:29.766172144  [2023-08-30 16:51:29] ffmpeg.Frontdoor.detect        ERROR   : rtsp:https://*:*@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0: Connection timed out
2023-08-30 16:51:31.671919661  [2023-08-30 16:51:31] frigate.video                  ERROR   : Frontdoor: Unable to read frames from ffmpeg process.

I dont re-stream through frigate. I have a HomeAssistant page which is a live view through frigate. Perhaps that is not re-streaming, but I thought that would still be going through frigate instead of connecting directly to camera.

if you don't have go2rtc setup then the home assistant entity is just a snapshot that updates once per second

How would I investigate the CUDA-related error?

for one I would start by using the recommended ffmpeg preset instead of manual args. Other then that, need to look up the error and see what others say on it

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

the recommended ffmpeg preset

It seems like my setup is pretty out-dated. Can you point me to a setup page where I can learn more about this? I remember battling for a while to find the proper manual arguments to make these cameras work, but like I said earlier that was several versions of frigate ago.

@NickM-27
Copy link
Sponsor Collaborator

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

So I should

  1. change my config file:
    hwaccel_args: -c:v h264_cuvid

to this:
hwaccel_args: preset-nvidia-h264

  1. [And add the whole deploy section about the NVidia stuff to my dockercompose.] nevermind, i realized I already have this part.

OK I'll make those changes and try again. Thank you!

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

if you don't have go2rtc setup then the home assistant entity is just a snapshot that updates once per second

After making your recommended changes, I went back to HomeAssistant and I'm definitely getting more than one frame per second on my dashboard through frigate. Is there some other way (perhaps an old, abandon system) that was able to make that happen without go2rtc?

@NickM-27
Copy link
Sponsor Collaborator

Is there some other way (perhaps an old, abandon system) that was able to make that happen without go2rtc?

yes, it used to use rtmp, that has been deprecated, as is explained in the 0.12 release notes

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

Is there some other way (perhaps an old, abandon system) that was able to make that happen without go2rtc?

yes, it used to use rtmp, that has been deprecated, as is explained in the 0.12 release notes

Thank you very much for pointing out those Release Notes to me, I had not seen those before. That was the first I saw your involvement. Let me take a second to say THANK YOU for all of these changes. It looks like I was not paying attention for too long and you've accomplished much of what I was disappointed by not having previously. I have some tinkering to do.

I'm not sure I understand how my frontdoor feed is still working if rtmp is deprecated and i have rtmp enabled: false in my current config. Is there something more I would need to investigate/do to ensure that is truly turned off as I look into enabling the built-in go2rtc?

@NickM-27
Copy link
Sponsor Collaborator

I'm not sure I understand how my frontdoor feed is still working if rtmp is deprecated and i have rtmp enabled: false in my current config. Is there something more I would need to investigate/do to ensure that is truly turned off as I look into enabling the built-in go2rtc?

Still working where? as I said previously, the HA feed is just a snapshot that updates once per second if go2rtc is not setup

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

I'm not sure I understand how my frontdoor feed is still working if rtmp is deprecated and i have rtmp enabled: false in my current config. Is there something more I would need to investigate/do to ensure that is truly turned off as I look into enabling the built-in go2rtc?

Still working where? as I said previously, the HA feed is just a snapshot that updates once per second if go2rtc is not setup

I wish you were sitting next to me. Here I have the pro telling me there's no way I'm getting more than 1fps, but I'm sitting at my computer looking at HomeAssistant and watching a bird smoothly fly by and trees smoothly waving in the wind.

When I first navigate to that page in HA, you are 100% right. It's not great quality, and its 1fps. But after a few seconds, the "high quality mode" kicks in and I get HD camera quality and a pretty smooth fps. Is there a log I can share with you that would show you what is happening?

@NickM-27
Copy link
Sponsor Collaborator

what is your current config?

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

what is your current config?

In HA or in frigate? The only change I've made in frigate is the codec thing u suggested a minute ago.

In HA, I am using a custom frigate card. I see the little bird-like icon in the topleft corner of the stream I am talking about.

My yaml looks like this:
type: custom:frigate-card
cameras:

  • camera_entity: camera.front_doorbell_main
    id: frontdoor
    live_provider: auto
    view:
    default: live
    camera_select: live
    menu:
    buttons:
    cameras:
    enabled: false
    download:
    enabled: false
    media_player:
    enabled: false

@NickM-27
Copy link
Sponsor Collaborator

oh, you didn't say you were using the frigate card, in that case it is using the jsmpeg feed from frigate which is 5 fps

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

5fps is plenty for my re-streaming purposes. So then I wont bother with the go2rtc since I can use HA to get 5fps on all my cameras using the frigate card. That works for me.
I will stop making changes for now I guess. I am comfortable with my re-streaming situation and my HA notifications. Hopefully the updated plugin setting you mentioned keeps the cameras online for longer. Thank you again for this discussion.

@NickM-27
Copy link
Sponsor Collaborator

How long did it stay online before?

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

Not long. Maybe a day or two.

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

I am trying to set up FrontDoor with separate streams, but its not working. Any idea why? Does that "Roles" stuff not work anymore?

  Frontdoor:
    ffmpeg:
      hwaccel_args: preset-nvidia-h264
      inputs:
        - path: rtsp:https://admin:***@192.168.7.166:554/cam/realmonitor?channel=1&subtype=0
	  roles: 
	     - record
        - path: rtsp:https://admin:***@192.168.7.166:554/cam/realmonitor?channel=1&subtype=1
	  roles: 
	     - detect
    record: 
      enabled: True
      retain: 
        days: 2
      events:
        retain:
          default: 4
          mode: motion
    snapshots:
      enabled: True
    rtmp: 
      enabled: False
    detect:
      width: 720
      height: 576
    objects:
      track:
        - person
        - dog

@NickM-27
Copy link
Sponsor Collaborator

what are the logs?

@Maxxell
Copy link
Author

Maxxell commented Aug 31, 2023

I don't get any. Frigate won't event start.

I'm gonna shut down for the night. Thanks again.

@NickM-27
Copy link
Sponsor Collaborator

I don't get any. Frigate won't event start.

I'm gonna shut down for the night. Thanks again.

if frigate is failing to start, there will be logs showing the error in the config

@s482dcaw
Copy link

s482dcaw commented Sep 6, 2023

For what it's worth, I had the same problem with cameras and streams getting disconnecting and giving error messages. Here's how the problem went away (for a couple of days now, I may need to update that in the future if it reappears).
In my case, I have a Coral Edge TPU connected in a USB-3 port, and an external SSD disk for storage of recordings and clips, also connected to a USB-3 port.

Solution 1: Do not use the Coral at all; use OpenVino instead. CPU is "Intel(R) Core(TM) i3-4150T CPU @ 3.00GHz". Coral's inference speed is slightly over 10ms. OpenVino's inference in this CPU is 30-40ms. If that is acceptable, try it.

Solution 2: Bind mount the standard edgetpu library to the docker container. The container has preinstalled the package "libedgetpu1-max" which has the Coral running at the maximum frequency (500 MHz).
Installing on the host libedgetpu1-std which runs Coral at the reduced frequency (250 MHz) and mounting the library "/usr/lib/x86_64-linux-gnu/libedgetpu.so.1.0", so having frigate use the throttled library, also made the errors disappear. That takes the inderence speed to ~17ms over the initial ~10ms

@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Sep 6, 2023

@s482dcaw sounds like your device is struggling to power both USB devices, that's when a USB powered hub is recommended.

@s482dcaw
Copy link

s482dcaw commented Sep 6, 2023

That is probable, and since the error messages are pretty similar, others may have the same problem. That's why I wrote down the details.

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

it did not... :-(
Do I need to disable the nvidia driver or card or something? I ran through both steps on that walkthrough but am getting no cameras and same results for vainfo:

(base) josh@PowerSpec:~/Docker/frigate$ sudo vainfo
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

@NickM-27
Copy link
Sponsor Collaborator

Do I need to disable the nvidia driver or card or something?

No, I run my integrated GPU alongside nvidia GPU without issues.

Okay but what happens when you do ls /dev/dri

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

3 options:
by-path
card0
renderD128

@NickM-27
Copy link
Sponsor Collaborator

and that was run on the host right?

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

I'm using ssh to do all this from a different machine. So... yes?

@NickM-27
Copy link
Sponsor Collaborator

okay, was the machine restarted after the guide you followed?

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

No. I will try a reboot.

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

rebooted and tried vainfo:
(base) josh@PowerSpec:~$ sudo vainfo
[sudo] password for josh:
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit

@NickM-27
Copy link
Sponsor Collaborator

after reboot what is in /dev/dri ?

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

Same three options

@NickM-27
Copy link
Sponsor Collaborator

what about if you run ls /usr/lib/x86_64-linux-gnu/dri/

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

(base) josh@PowerSpec:/dev/dri$ ls /usr/lib/x86_64-linux-gnu/dri/
crocus_dri.so       kms_swrast_dri.so     radeon_dri.so
d3d12_dri.so        nouveau_dri.so        radeonsi_dri.so
d3d12_drv_video.so  nouveau_drv_video.so  radeonsi_drv_video.so
i915_dri.so         nouveau_vieux_dri.so  swrast_dri.so
i965_dri.so         r200_dri.so           virtio_gpu_dri.so
i965_drv_video.so   r300_dri.so           virtio_gpu_drv_video.so
iHD_drv_video.so    r600_dri.so           vmwgfx_dri.so
iris_dri.so         r600_drv_video.so     zink_dri.so

@NickM-27
Copy link
Sponsor Collaborator

okay try running

export LIBVA_DRIVER_NAME=iHD
vainfo

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

(base) josh@PowerSpec:/dev/dri$ export LIBVA_DRIVER_NAME=iHD
vainfo
error: can't connect to X server!
libva info: VA-API version 1.20.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_15
DRM_IOCTL_I915_GEM_APERTURE failed: Invalid argument
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [22]
param: 4, val: 0
libva error: /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed
libva info: va_openDriver() returns 1
vaInitialize failed with error code 1 (operation failed),exit

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

I tried that twice. Once combined as you gave it, then separately. It gave same results both times.

@NickM-27
Copy link
Sponsor Collaborator

Not sure then, seems it doesn't like the driver or something else is weird

@Maxxell
Copy link
Author

Maxxell commented Sep 13, 2023

Frigate is the core function for this machine. Is there a better OS I should start over with?

@NickM-27
Copy link
Sponsor Collaborator

debian is what the docs recommend

@Maxxell
Copy link
Author

Maxxell commented Sep 14, 2023

I decided to leave the current machine running while I set up Debian on a different one (another i7 workstation with a 30-series GPU).

Question for you - if I leave the config.yaml with no hwaccel arguments in the current build, what exactly is happening? Is frigate asking the CPU to do the decoding without using the CPU's built-in GPU? So it's still the CPU doing the work, its just like asking the general-purpose CPU to work harder than if it could utilize the GPU parts which would be more efficient at doing the same thing? Do I understand that correctly? If so, am I over-tasking the CPU to handle 5 video feeds in this inefficient method for the time being?

@NickM-27
Copy link
Sponsor Collaborator

if I leave the config.yaml with no hwaccel arguments in the current build, what exactly is happening? Is frigate asking the CPU to do the decoding without using the CPU's built-in GPU? So it's still the CPU doing the work, its just like asking the general-purpose CPU to work harder than if it could utilize the GPU parts which would be more efficient at doing the same thing? Do I understand that correctly? If so, am I over-tasking the CPU to handle 5 video feeds in this inefficient method for the time being?

yes, it just uses the software decoder. Depends on the CPU and resolution of the stream that is being decoded

@Maxxell
Copy link
Author

Maxxell commented Sep 14, 2023

Its an i7-10700.
I have 5 streams, all some form of "high def". 4x 1080p, but one of them (frontdoor) is 2560x1920.
I did get the record/detect thing working so that there's a high-quality stream being recorded and a lower-quality stream for detections - does that help?

@NickM-27
Copy link
Sponsor Collaborator

I did get the record/detect thing working so that there's a high-quality stream being recorded and a lower-quality stream for detections - does that help?

yes

@Maxxell
Copy link
Author

Maxxell commented Sep 14, 2023

Question - does the stuff under each camera on the System page in frigate always add up to 100% for CPU? Like, it's giving you a breakdown of the total demand being made by Frigate (regardless of the total potential of that CPU)?

Or is the System page a good way to gauge how hard the CPU is working overall?

@NickM-27
Copy link
Sponsor Collaborator

each CPU % field is the % of a single CPU core that that specific process is using

@Maxxell
Copy link
Author

Maxxell commented Sep 14, 2023

That's very useful, thanks. Looks like my frontdoor is consistently eating up between 30 and 50% of that CPU. The ffprobe on that System page lets me see that the low quality stream is also running at full HD. I'll go into that camera's settings and change the quality of the backup stream. Everything else on here is typically below 5%, which seems like not a bad way to let it run long-term.

@NickM-27
Copy link
Sponsor Collaborator

which seems like not a bad way to let it run long-term.

another thing to consider is that the software decoder is slower than a hardware decoder, so there will be more latency in the detections

@Maxxell
Copy link
Author

Maxxell commented Sep 14, 2023

For the sake of completing the record. The camera was set up fine. My config.yml erroneously had the same rtsp path for both detect and record. I corrected the config file.
First I did a "restart frigate" within the UI. That didn't help the CPU usage. So I restarted the container directly with Portainer. Now the CPU usage for that camera is right in the same <5% range as the rest of my feeds.

@Maxxell
Copy link
Author

Maxxell commented Oct 5, 2023

Update: the new machine has been running smoothly. New hardware, running on Debian, but all my yaml files are the same. Must have been something in the hardware causing the original problems.

One last question for you before I mark this closed...
Can I run an OBICO server on the same machine? IF they both want to access the nvidia gpu?
https://www.obico.io/docs/server-guides/advanced/nvidia-gpu/

@NickM-27
Copy link
Sponsor Collaborator

NickM-27 commented Oct 5, 2023

Yes, multiple containers can access the nvidia gpu at the same

@NickM-27 NickM-27 closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants