blakeblackshear / frigate

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

[Support]: Hardware Decode Problem with AMD GPU HD6370M #3568

Closed wes1993 closed 2 years ago

wes1993 commented 2 years ago

Describe the problem you are having

Hello, i can't use the AMD for hardware decode of video stream... I have cameras that are 3MP, i have also configured everithing like the manual, this is my output: vainfo: image dmesg: image

Using Substream Radeontop: image Top: image

Mainstream Radeontop: image Top: image

I have tried to use also the substream because i have found an issue here and seems that if you use a 3Mp stream GPU won't work but no way on how to fix this unfortunately :-(

Version

0.10.1-83481AF

Frigate config file

mqtt:
  host: 192.168.0.15
  user: mqttuser
  password: pass

logger:
  # Optional: default log level (default: shown below)
  default: debug
ffmpeg:
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  #hwaccel_args: []
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128

#  input_args:
#    - -headers
#    - "Authorization: Basic YWRtaW46"

cameras:
  bagnostudio: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.51/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
 #       - -c:v
 #       - h264_cuvid
 #    rtmp:
 #      enabled: True # <-- RTMP should be disabled if your stream is not H264

  parcheggio: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: rtsp://192.168.0.60:554/realmonitor?channel=0&stream=0.sdp # <----- Update for your camera
          roles:
#            - detect
            - rtmp
      input_args: -an
##        - -headers
##        - "Authorization: Basic YWRtaW46"
    rtmp:
      enabled: True # <-- RTMP should be disabled if your stream is not H264
#    detect:
#      width: 2304 # <---- update for your camera's resolution
#      height: 1296 # <---- update for your camera's resolution

  cameraospiti: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.52/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264
  giardinopost: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.53/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264

  ripostigio: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.54/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264
  parchmoto: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.55/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264

  laghetto: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.56/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264

  parchmoto: # <------ Name the camera
    ffmpeg:
      inputs:
        - path: http://192.168.0.55/livestream/12 # <----- Update for your camera
          roles:
            - rtmp
      input_args:
        - -headers
        - "Authorization: Basic YWRtaW46"
#    rtmp:
#      enabled: True # <-- RTMP should be disabled if your stream is not H264

Relevant log output

None

FFprobe output from your camera

MainStream:
root@b7fa99e1ad31:/opt/frigate# ffprobe -headers "Authorization: Basic YWRtaW46" -i "http://192.168.0.50/livestream/11"
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[http @ 0x562470f03800] No trailing CRLF found in HTTP header. Adding it.
[h264 @ 0x562470f10000] Invalid NAL unit 8, skipping.
    Last message repeated 1 times
[h264 @ 0x562470f10000] Invalid NAL unit 0, skipping.
[h264 @ 0x562470f10000] Invalid NAL unit 8, skipping.
    Last message repeated 5 times
Input #0, h264, from 'http://192.168.0.50/livestream/11':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, yuv420p(tv, bt470bg, progressive), 2304x1296, 15 fps, 15 tbr, 1200k tbn, 30 tbc

SubStream:
root@b7fa99e1ad31:/opt/frigate# ffprobe -headers "Authorization: Basic YWRtaW46" -i "http://192.168.0.50/livestream/12"
ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmfx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-vaapi --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[http @ 0x5640af00f800] No trailing CRLF found in HTTP header. Adding it.
[extract_extradata @ 0x5640af0136c0] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[h264 @ 0x5640af01c000] Invalid NAL unit 0, skipping.
    Last message repeated 1 times
[h264 @ 0x5640af01c000] Invalid NAL unit 8, skipping.
    Last message repeated 5 times
[h264 @ 0x5640af01c000] missing picture in access unit with size 17
Input #0, h264, from 'http://192.168.0.50/livestream/12':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, yuv420p(tv, bt470bg, progressive), 640x360, 15 fps, 15 tbr, 1200k tbn, 30 tbc

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Mixed

Camera make and model

Misecu (DVR163) - 3MP

Any other information that may be helpful

No response

NickM-27 commented 2 years ago

When you set those input args with the auth header you're overwriting all the default input args. I'd recommend adding back those args as well.

Also, when you run top the processes that are using the GPU (and all ffmpeg processes) will show as ffmpeg ..... so frigate.detector using lots of cpu wouldn't change I don't think.

Please provide logs as well

wes1993 commented 2 years ago

Thanks a lot for your reply @NickM-27. Can you give me the default args so I can add also this args?

I will send to you the screen of FFMPEG also

NickM-27 commented 2 years ago

Default input args are here: https://github.com/blakeblackshear/frigate/blob/master/frigate/config.py#L319

wes1993 commented 2 years ago

I have updated the config, this is the new config: image But now i can't see the cameras:

image

NickM-27 commented 2 years ago

I have updated the config, this is the new config: image But now i can't see the cameras:

image

Oh that's my bad, didn't see that it was an http camera. Maybe try these args (along with the headers) instead: https://docs.frigate.video/configuration/camera_specific#reolink-410520-possibly-others

If that doesn't work, then it may also be worth trying out frigate 0.11 (currently release candidate) as that uses a different ffmpeg build and may work better.

wes1993 commented 2 years ago

Thanks a again a lot for your reply :-D This is the top command before the changes of the config file: image

if i change the config file video won't work :-( image

My new config file: image

NickM-27 commented 2 years ago

if i change the config file video won't work :-(

That's fine, can forget about the args for now as it seems it was working better before

Thanks a again a lot for your reply :-D This is the top command before the changes of the config file: image

This is more interesting to me. The ffmpeg processes look normal level. hwaccel would help but the main process is the detector process which is the main source of your CPU usage.

Either way, I'd say trying 0.11 to see if that helps pick up the hwaccel

wes1993 commented 2 years ago

ok i will try thanks a lot :-D P.S. Could i disable the detector process?

NickM-27 commented 2 years ago

P.S. Could i disable the detector process?

Disabling object detection from the frontend UI should lower this CPU usage.

wes1993 commented 2 years ago

for disable the detector from UI i should click here? image Because if yes seems that won't work :-( If i click the men still blue

NickM-27 commented 2 years ago

for disable the detector from UI i should click here? image Because if yes seems that won't work :-( If i click the men still blue

yes, clicking that to make it grey will disable object detection. You can also set detect -> enabled to false in the config (for now) while trying to work this out.

wes1993 commented 2 years ago

ok , i have updated to blakeblackshear/frigate:0.11.0-rc1 but now i have problem with ffmpeg image

Probably i have done something wrong?

NickM-27 commented 2 years ago

Please check the release notes for that release:

Some deployment approaches are overwriting the PATH environment value to an old value. If you see errors like No such file or directory: 'ffmpeg', then you need to stop overriding your PATH. This happens with both Proxmox LXC and Portainer (https://github.com/blakeblackshear/frigate/issues/3223)

wes1993 commented 2 years ago

Sorry @NickM-27 my bad :-( So now i have frigate 0.11 up and working: [2022-08-01 18:57:10] frigate.app INFO : Starting Frigate (0.11.0-37325c7)

But the usage related to AMDGPU is the same.. :-(

I'm trying to disable detect but i don't know what is the correct config line :-(

NickM-27 commented 2 years ago

But the usage related to AMDGPU is the same.. :-(

Please give logs. Also, make sure that the AMD GPU is passed in through all the layers of your setup and that you have the AMD driver installed on your host.

I'm trying to disable detect but i don't know what is the correct config line :-(

You can add

detect:
  enabled: false

to your config but keep in mind this disables frigates main features so mostly useful for lower CPU usage while figured out the GPU issue 👍

wes1993 commented 2 years ago

Thanks a lot for your help really thanks @NickM-27. Now i have reached a good point thanks to the wonderful config line: detect: enabled: false

Now my CPU usage is: image

and this is wonderful also because i have the rtmp stream working :-D

I don't know how can i see the log related to the GPU, i have seen the usage with radeontop: image

But i have everthing to 0 except for the VRAM and GTT and i don't know if is normal

This is the output command dmesg for the driver: image seems ok

NickM-27 commented 2 years ago

This is what mine looks like when working:

Screen Shot 2022-08-01 at 11 30 02 AM

I don't know how can i see the log related to the GPU

Need to see the frigate logs. Your initial vainfo inside the frigate contianer seemed to indicate some error as well, should look into that.

wes1993 commented 2 years ago

ok so this is my vainfo log: image Where i can see the frigate logs? from portainer log?

[2022-08-01 19:36:16] frigate.app                    INFO    : Starting Frigate (0.11.0-37325c7)
Starting migrations
[2022-08-01 19:36:16] peewee_migrate                 INFO    : Starting migrations
[2022-08-01 19:36:16] peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
[2022-08-01 19:36:16] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
There is nothing to migrate
[2022-08-01 19:36:16] peewee_migrate                 INFO    : There is nothing to migrate
[2022-08-01 19:36:16] frigate.mqtt                   DEBUG   : MQTT connected
[2022-08-01 19:36:16] detector.cpu                   INFO    : Starting detection process: 224
[2022-08-01 19:36:16] frigate.app                    INFO    : Output process started: 226
[2022-08-01 19:36:16] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-08-01 19:36:16] ws4py                          INFO    : Using epoll
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for parcheggio: 230
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for bagnostudio: 232
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for cameraospiti: 234
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for giardinopost: 236
[2022-08-01 19:36:16] frigate.mqtt                   DEBUG   : on_detect_toggle: frigate/parcheggio/detect/set OFF
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for ripostigio: 238
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for parchmoto: 239
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for laghetto: 241
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for capanno: 243
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for veranda: 244
[2022-08-01 19:36:16] frigate.app                    INFO    : Camera processor started for studio: 246
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for parcheggio: 247
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for bagnostudio: 251
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for cameraospiti: 254
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for giardinopost: 259
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for ripostigio: 263
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for parchmoto: 268
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for laghetto: 280
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for capanno: 296
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for veranda: 300
[2022-08-01 19:36:16] frigate.app                    INFO    : Capture process started for studio: 304
[2022-08-01 19:36:16] urllib3.connectionpool         DEBUG   : Starting new HTTPS connection (1): api.github.com:443
[2022-08-01 19:36:17] urllib3.connectionpool         DEBUG   : https://api.github.com:443 "GET /repos/blakeblackshear/frigate/releases/latest HTTP/1.1" 200 847
[2022-08-01 19:36:17] ws4py                          INFO    : Using epoll
[2022-08-01 19:36:17] peewee.sqliteq                 DEBUG   : received query UPDATE "event" SET "end_time" = ("event"."start_time" + ?) WHERE ("event"."end_time" IS ?)
[2022-08-01 19:36:17] peewee                         DEBUG   : ('UPDATE "event" SET "end_time" = ("event"."start_time" + ?) WHERE ("event"."end_time" IS ?)', [30, None])
[2022-08-01 19:36:23] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/studio/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/parcheggio/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/parchmoto/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/bagnostudio/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/ripostigio/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/giardinopost/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/laghetto/all.
[2022-08-01 19:36:24] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/cameraospiti/all.
[2022-08-01 19:36:25] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/capanno/all.
[2022-08-01 19:36:28] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/giardinopost/motion.
[2022-08-01 19:36:29] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/veranda/all.
[2022-08-01 19:36:29] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/ripostigio/motion.
[2022-08-01 19:36:29] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/parchmoto/motion.
[2022-08-01 19:36:30] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/bagnostudio/motion.
[2022-08-01 19:37:03] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/bagnostudio/motion.
[2022-08-01 19:37:08] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/parchmoto/motion.
[2022-08-01 19:37:14] frigate.mqtt                   DEBUG   : Received mqtt message on frigate/ripostigio/motion.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start expire recordings (new).
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start deleted cameras.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" NOT IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) AND ("t1"."end_time" < ?))', ['parcheggio', 'bagnostudio', 'cameraospiti', 'giardinopost', 'ripostigio', 'parchmoto', 'laghetto', 'capanno', 'veranda', 'studio', 1659375437.30682])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] peewee.sqliteq                 DEBUG   : received query DELETE FROM "recordings" WHERE (0 = 1)
[2022-08-01 19:37:17] peewee                         DEBUG   : ('DELETE FROM "recordings" WHERE (0 = 1)', [])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End deleted cameras.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start all cameras.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: parcheggio.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['parcheggio', 1659375437.318149])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: parcheggio.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: bagnostudio.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['bagnostudio', 1659375437.321858])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: bagnostudio.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: cameraospiti.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['cameraospiti', 1659375437.323844])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: cameraospiti.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: giardinopost.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['giardinopost', 1659375437.325972])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: giardinopost.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: ripostigio.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['ripostigio', 1659375437.327923])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: ripostigio.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: parchmoto.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['parchmoto', 1659375437.330306])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: parchmoto.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: laghetto.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['laghetto', 1659375437.333487])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: laghetto.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: capanno.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['capanno', 1659375437.336492])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: capanno.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: veranda.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['veranda', 1659375437.339083])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: veranda.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start camera: studio.
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" WHERE (("t1"."camera" = ?) AND ("t1"."end_time" < ?)) ORDER BY "t1"."start_time"', ['studio', 1659375437.340828])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Expiring 0 recordings
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End camera: studio.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End all cameras.
[2022-08-01 19:37:17] frigate.record                 DEBUG   : End expire recordings (new).
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Start expire files (legacy).
[2022-08-01 19:37:17] peewee                         DEBUG   : ('SELECT "t1"."id", "t1"."camera", "t1"."path", "t1"."start_time", "t1"."end_time", "t1"."duration", "t1"."motion", "t1"."objects" FROM "recordings" AS "t1" ORDER BY "t1"."start_time" LIMIT ? OFFSET ?', [1, 0])
[2022-08-01 19:37:17] frigate.record                 DEBUG   : Oldest recording in the db: 1659375437.347722
NickM-27 commented 2 years ago

Please remove

logger:
  # Optional: default log level (default: shown below)
  default: debug

restart and repaste the logs from the same place. The debug logs are way too verbose to get anything useful.

Your VAINFO seems to work as we would expect and jellyfin finds the right driver.

From within the container can you please run ffprobe http://192.168.0.51/livestream/12 ? I am wondering if the format is making it so hwaccel isn't being utilized, not sure how those streams are encoded

wes1993 commented 2 years ago

I have also seen that if i use the mainstream (3MP) instead of substream video frigate won't use the GPU at all :-( Radeontop: image

Top: image

so seems that GPU won't decode 3Mp video feed?

NickM-27 commented 2 years ago

Okay scratch that then, seems like radeontop may be off.

With those different top numbers seems that hwaccel is definitely working as expected. Not sure why there would be a different for the main stream unless it is encoded differently (like h265 which is not supported by your GPU).

wes1993 commented 2 years ago

ffprobe Main Stream: image image

ffproble Sub Stream: image

The new LOG:

[2022-08-01 19:48:22] frigate.app                    INFO    : Output process started: 226
[2022-08-01 19:48:22] ws4py                          INFO    : Using epoll
[2022-08-01 19:48:22] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for parcheggio: 230
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for bagnostudio: 232
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for cameraospiti: 233
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for giardinopost: 235
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for ripostigio: 236
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for parchmoto: 238
[2022-08-01 19:48:22] frigate.app                    INFO    : Camera processor started for laghetto: 240
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for parcheggio: 242
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for bagnostudio: 245
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for cameraospiti: 248
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for giardinopost: 252
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for ripostigio: 257
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for parchmoto: 262
[2022-08-01 19:48:22] frigate.app                    INFO    : Capture process started for laghetto: 265
[2022-08-01 19:48:22] ws4py                          INFO    : Using epoll
[2022-08-01 19:48:34] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:48534]
[2022-08-01 19:48:36] frigate.video                  ERROR   : laghetto: Unable to read frames from ffmpeg process.
[2022-08-01 19:48:36] frigate.video                  ERROR   : laghetto: ffmpeg process is not running. exiting capture thread...
[2022-08-01 19:48:42] watchdog.laghetto              ERROR   : Ffmpeg process crashed unexpectedly for laghetto.
[2022-08-01 19:48:42] watchdog.laghetto              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-08-01 19:48:42] ffmpeg.laghetto.detect         ERROR   : [http @ 0x565176c016c0] No trailing CRLF found in HTTP header. Adding it.
[2022-08-01 19:48:42] ffmpeg.laghetto.detect         ERROR   : http://192.168.0.56/livestream/11: Invalid data found when processing input
[2022-08-01 19:48:56] frigate.video                  ERROR   : laghetto: Unable to read frames from ffmpeg process.
[2022-08-01 19:48:56] frigate.video                  ERROR   : laghetto: ffmpeg process is not running. exiting capture thread...
[2022-08-01 19:48:59] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:48534]
[2022-08-01 19:49:00] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:47478]
[2022-08-01 19:49:02] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:34488]
[2022-08-01 19:49:02] watchdog.laghetto              ERROR   : Ffmpeg process crashed unexpectedly for laghetto.
[2022-08-01 19:49:02] watchdog.laghetto              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-08-01 19:49:02] ffmpeg.laghetto.detect         ERROR   : [http @ 0x56157c6f76c0] No trailing CRLF found in HTTP header. Adding it.
[2022-08-01 19:49:02] ffmpeg.laghetto.detect         ERROR   : http://192.168.0.56/livestream/11: Invalid data found when processing input
[2022-08-01 19:49:04] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:8082 | Remote => 127.0.0.1:34488]
[2022-08-01 19:49:16] frigate.video                  ERROR   : laghetto: Unable to read frames from ffmpeg process.
[2022-08-01 19:49:16] frigate.video                  ERROR   : laghetto: ffmpeg process is not running. exiting capture thread...
[2022-08-01 19:49:22] watchdog.laghetto              ERROR   : Ffmpeg process crashed unexpectedly for laghetto.
[2022-08-01 19:49:22] watchdog.laghetto              ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-08-01 19:49:22] ffmpeg.laghetto.detect         ERROR   : [http @ 0x5623500a46c0] No trailing CRLF found in HTTP header. Adding it.

Seems both H264

NickM-27 commented 2 years ago

Interesting, seems there is something that ffmpeg does not like in the mainstream. Both are h264 so not exactly sure. Probably worth playing around with the cameras settings for the main stream, and you may want to look around to see if others have tried to use ffmpeg with your specific cameras.

Either way, sub stream is recommended for use in the detect role anyway. As far as your high CPU usage with detection, I'd recommend turning it on for certain cameras gradually and watching the frigate debug view for the camera live feed so you can see which one has lots of motion or other issues causing such high detection.

wes1993 commented 2 years ago

ok so thanks a lot for your help :-D I don't have settings in the cameras, no web access or something else shit chinese cameras... :-( unfortunately this shit cameras are rare and i don't know why this problem with main stream video feed, i have found another ticket but unfortunately no way to solve the problem :-( Here: https://github.com/blakeblackshear/frigate/issues/2597 Really thanks a lot for all your help and patience :-D

stale[bot] commented 2 years 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.