blakeblackshear / frigate

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

[HW Accel Support]: Decoding mjpeg stream from esp32 on rpi #5839

Closed COUBOT closed 1 year ago

COUBOT commented 1 year ago

Describe the problem you are having

Hey there,

I have 2 esp32 cams installed. I am using a rasbperry pi 4gb with a coral tpu. The gpu_mem is set to 512. The cpu usage of the addon is about 22%. So I was wondering if the hardware acceleration even works. So I deleted it and the cpu usage was the same. How can you see if the hardware acceleration is actually working?

Version

0.11.1-2EADA21

Frigate config file

detectors:
  coral:
    type: edgetpu
    device: usb

mqtt:
  host: 192.168.178.67
  user: mqtt-user
  password: 2883

ffmpeg:
  hwaccel_args: -c:v h264_v4l2m2m

cameras:

  Vogelkamera:
    ffmpeg:
      inputs:
        - path: http://192.168.178.78:81/stream
          roles:
            - detect
            - record
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -c:v mjpeg
      output_args:
        detect: -f rawvideo -pix_fmt yuv420p -an
#        record: -f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an
#        rtmp: -f flv -pix_fmt yuv420p -c:v libx264 -preset ultrafast -an
    rtmp:
      enabled: False
    record:
        enabled: true
        retain:
            days: 5
    detect:
      enabled: True
      width: 1600
      height: 1200
      fps: 5
    objects:
      track:
        - person
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      retain:
        default: 5

  Auffahrt:
    ffmpeg:
      inputs:
        - path: http://192.168.178.76:81/stream
          roles:
            - detect
            - record
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -c:v mjpeg
      output_args:
        detect: -f rawvideo -pix_fmt yuv420p -an
#        record: -f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an
#        rtmp: -f flv -pix_fmt yuv420p -c:v libx264 -preset ultrafast -an
    rtmp:
      enabled: False
    record:
        enabled: true
        retain:
            days: 5
    detect:
      enabled: True
      width: 1600
      height: 1200
      fps: 5
    objects:
      track:
        - person
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      retain:
        default: 5

docker-compose file or Docker CLI command

-

Relevant log output

-

FFprobe output from your camera

-

Operating system

HassOS

Install method

HassOS Addon

Network connection

Wired

Camera make and model

Esp32-Cam

Any other information that may be helpful

No response

NickM-27 commented 1 year ago

The esp32 sends an mjpeg stream so the hardware acceleration args of h264_v4l2m2m would not be expected to do anything (I would actually expect an error).

also, the pi does not have any gpu monitoring so the only way to get an idea if hwaccel is working is if the CPU % is lower

COUBOT commented 1 year ago

Weird I don't get an error. I can't find anything to lower the cpu usage. Is there something I can do about it?

NickM-27 commented 1 year ago

Not on an rpi, as far as I can tell those don't have an mjpeg hardware decoder

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.