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

[Config Support]: Enable HEVC/H.265 on Friagte #3561

Closed
ghost opened this issue Jul 30, 2022 · 11 comments
Closed

[Config Support]: Enable HEVC/H.265 on Friagte #3561

ghost opened this issue Jul 30, 2022 · 11 comments

Comments

@ghost
Copy link

ghost commented Jul 30, 2022

Describe the problem you are having

I am using frigate in Home Assistant installed on a Raspberry PI4B and try to configure a Reolink RLC810A for detecting in 4K(Main Stream). I noticed H.265 works without Hardware Acceleration but with very high CPU usage and very laggy. I added the following flags to hwaccel_args and I get a green screen.

Is there a way to encode H265 with hwaccel_args on PI4?

Version

0.10.1-83481AF

Frigate config file

mqtt:
  host: -
  user: -
  password: -  
cameras:
  cam1:
    ffmpeg:
      inputs:
        - path: rtsp://admin:@ipaddress:554//h265Preview_01_main
          roles:
            - detect
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
    rtmp:
      enabled: False
    detect:
      fps: 3
      width: 3840
      height: 2160      
    snapshots:
      enabled: True

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-07-30 12:36:25] frigate.app                    INFO    : Starting Frigate (0.10.1-83481af)
[2022-07-30 12:36:25] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2022-07-30 12:36:25] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-07-30 12:36:25] peewee_migrate                 INFO    : There is nothing to migrate
[2022-07-30 12:36:25] frigate.app                    INFO    : Output process started: 218
[2022-07-30 12:36:25] detector.cpu                   INFO    : Starting detection process: 217
[2022-07-30 12:36:25] frigate.app                    INFO    : Camera processor started for cam1: 221
[2022-07-30 12:36:25] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-07-30 12:36:25] frigate.app                    INFO    : Capture process started for cam1: 222
[2022-07-30 12:36:25] ws4py                          INFO    : Using epoll
[2022-07-30 12:36:25] ws4py                          INFO    : Using epoll

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

CPU (no coral)

Any other information that may be helpful

The hardware acceleration flags work with H264 substream but I need to work it with H265 Main Stream

@NickM-27
Copy link
Collaborator

The hardware acceleration flag is h264_v4l2m2m so naturally it will only work with h264. Did you try hevc_v4l2m2m ?

@ghost
Copy link
Author

ghost commented Jul 30, 2022

Thank you. I tried it with hevc_v4l2m2m but unfortunately it had no effect, still showing a green screen. Debug Camera FPS is also at 0.

@NickM-27
Copy link
Collaborator

NickM-27 commented Jul 30, 2022

You can run ffmpeg -decoders inside the frigate container to see what decoders are supported

@ghost
Copy link
Author

ghost commented Jul 30, 2022

Yes the command gave me a bunch of codecs but from my research the only suitable codec for my PI4 is actually hevc_v4l2m2m. But I can't explain why it is not working.

@NickM-27
Copy link
Collaborator

Maybe try frigate 0.11 RC it has a new ffmpeg build that could work better

@blakeblackshear
Copy link
Owner

I don't believe the Pi has hwaccel for h265

@NickM-27
Copy link
Collaborator

I don't believe the Pi has hwaccel for h265

Oh yeah, looks like it is an open issue in the jellyfin repo jellyfin/jellyfin-ffmpeg#129

@mdkeil
Copy link

mdkeil commented Aug 24, 2022

workaround to use h264-streams from RLC810A:

  1. upgrade Fw to last from here
  2. change encode resolution for "clear"-stream to 2560*1440
  3. enable RMTP under Network-Settings/Port-Settings
  4. you can use following h264 RMTP-streams now:
    clean (2560x1440): rtmp://{IP}/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={password}
    balanced (896x512): rtmp://{IP}/bcs/channel0_ext.bcs?channel=0&stream=2&user=admin&password={password}
    fluent (640x360): rtmp://{IP}/bcs/channel0_sub.bcs?channel=0&stream=1&user=admin&password={password}

@mpietruschka
Copy link

I don't believe the Pi has hwaccel for h265

It does... https://datasheets.raspberrypi.com/rpi4/raspberry-pi-4-datasheet.pdf

H.265 (HEVC) hardware decode (up to 4Kp60)
H.264 hardware decode (up to 1080p60)

@NickM-27
Copy link
Collaborator

I don't believe the Pi has hwaccel for h265

It does... https://datasheets.raspberrypi.com/rpi4/raspberry-pi-4-datasheet.pdf

H.265 (HEVC) hardware decode (up to 4Kp60)
H.264 hardware decode (up to 1080p60)

It supports h265 but ffmpeg does not currently support it

@github-actions
Copy link

github-actions bot commented Oct 1, 2022

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.

@github-actions github-actions bot added the stale label Oct 1, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
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

4 participants