frigate: [HW Accel Support]: Hardware acceleration not working with transpose parameter

Describe the problem you are having

When I rotate the camera stream using transpose=1 as an output argument I get the errors shown in the logs below. Disabling hardware acceleration by commenting out the corresponding lines solves the problem and the stream gets rotated but the CPU usage is ten times higher than before.

Version

0.12.1-367d724

Frigate config file

mqtt:
  host: mqtt.server.com

#ffmpeg:
#  hwaccel_args: preset-vaapi

detectors:
  coral:
    type: edgetpu
    device: pci

birdseye:
  mode: continuous

objects:
  track:
    - person
    - car

record:
  enabled: true
  events:
    pre_capture: 5
    post_capture: 5
    objects:
      - person
      - car
    retain:
      default: 5
      mode: active_objects
      objects:
        person: 15
        car: 15

cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://username:password@192.168.170.21:554/ch1/main
          roles:
            - detect
            - record
      output_args:
        detect: -vf transpose=1 -f rawvideo
    detect:
      width: 1080
      height: 1920

docker-compose file or Docker CLI command

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "64mb" # update for your cameras based on calculation above
    devices:
      - /dev/apex_0:/dev/apex_0 # passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /root/frigate/config.yml:/config/config.yml
      - /root/frigate/media/:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554" # RTSP feeds
      - "8555:8555/tcp" # WebRTC over tcp
      - "8555:8555/udp" # WebRTC over udp

Relevant log output

2023-10-25 18:53:00.319213934  [INFO] Starting Frigate...
2023-10-25 18:53:00.811289591  [2023-10-25 18:53:00] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2023-10-25 18:53:00.818095867  [2023-10-25 18:53:00] peewee_migrate                 INFO    : Starting migrations
2023-10-25 18:53:00.820740686  [2023-10-25 18:53:00] peewee_migrate                 INFO    : There is nothing to migrate
2023-10-25 18:53:00.828268472  [2023-10-25 18:53:00] frigate.app                    INFO    : Output process started: 219
2023-10-25 18:53:00.834672886  [2023-10-25 18:53:00] frigate.app                    INFO    : Camera processor started for back: 223
2023-10-25 18:53:00.837415874  [2023-10-25 18:53:00] frigate.app                    INFO    : Capture process started for back: 224
2023-10-25 18:53:00.987738040  [2023-10-25 18:53:00] detector.coral                 INFO    : Starting detection process: 218
2023-10-25 18:53:00.987831088  [2023-10-25 18:53:00] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as pci
2023-10-25 18:53:00.990401337  [2023-10-25 18:53:00] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found
2023-10-25 18:53:01.850074024  [2023-10-25 18:53:01] frigate.video                  ERROR   : back: Unable to read frames from ffmpeg process.
2023-10-25 18:53:01.850184124  [2023-10-25 18:53:01] frigate.video                  ERROR   : back: ffmpeg process is not running. exiting capture thread...
2023-10-25 18:53:13.872146987  [2023-10-25 18:53:13] frigate.record                 WARNING : Failed to probe corrupt segment /tmp/cache/back-20231025185301.mp4: 0 - b'[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55b70648b6c0] moov atom not found\n/tmp/cache/back-20231025185301.mp4: Invalid data found when processing input\n'
2023-10-25 18:53:13.872188161  [2023-10-25 18:53:13] frigate.record                 WARNING : Discarding a corrupt recording segment: /tmp/cache/back-20231025185301.mp4
2023-10-25 18:53:20.876593653  [2023-10-25 18:53:20] watchdog.back                  ERROR   : Ffmpeg process crashed unexpectedly for back.
2023-10-25 18:53:20.876595767  [2023-10-25 18:53:20] watchdog.back                  ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
2023-10-25 18:53:20.876596730  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : Multiple -filter, -af or -vf options specified for stream 0, only the last option '-filter:v transpose=1' will be used.
2023-10-25 18:53:20.876599626  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : [segment @ 0x55b2e3aec300] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2023-10-25 18:53:20.876607607  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scale_0'
2023-10-25 18:53:20.876620197  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : Error reinitializing filters!
2023-10-25 18:53:20.876620943  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : Failed to inject frame into filter network: Function not implemented
2023-10-25 18:53:20.876629004  [2023-10-25 18:53:20] ffmpeg.back.detect             ERROR   : Error while processing the decoded data for stream #0:0

FFprobe output from your camera

[{"return_code":0,"stderr":"","stdout":{"programs":[],"streams":[{"avg_frame_rate":"25/1","codec_long_name":"H.264/AVC/MPEG-4AVC/MPEG-4part10","height":1080,"width":1920}]}}]

Operating system

Debian

Install method

Docker Compose

Network connection

Wired

Camera make and model

Grundig GD-CI-CC2616V

Any other information that may be helpful

I am running Frigate in a Debian VM on Proxmox with iGPU of an Intel Core i5-12600K dedicated to Frigate via PCIe passthrough. The VM detects the GPU as shown below.

Screenshot (45)

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 23

Most upvoted comments

Feel free to create a new issue if something else comes up

oh I just realized the problem, this is an issue that was fixed in a later version of go2rtc, you can update it by following. https://docs.frigate.video/configuration/advanced#custom-go2rtc-version

You should add #hardware to the rotate stream so it uses the GPU instead of cpu

There are multiple problems here:

  1. you are overwriting the debug output args and not including the original ones that are needed
  2. you can not provide -vf when using the vaapi preset because that has its own -vf.

in general rotation is recommended to be done in go2rtc as that has it built in using hwaccel