Skip to content

Improved Multi GPU support #18958

@DanubeRS

Description

@DanubeRS

I have multiple cameras, which I am re-encoding to AV1 using the QSV encoder for archive in real-time. Its working great, but with the number of cameras, my A380 is quickly being overwhelmed while my HD630 is sitting there being lazy.

I would like to specify the hardware device being used, in particular, using the iGPU for decoding H.264 detect streams, then leveraging the dGPU for AV1 Encodes.

I was able to manage device selection (for recordings) by completely overriding the input_args and output_args as follows:

cameras:
  foo:
    enabled: true
    ffmpeg:
        - path: rtsp://my.go2rtc.server/foo
          hwaccel_args: ' '
          input_args: -hwaccel qsv -qsv_device /dev/dri/renderD129 -hwaccel_output_format
            qsv -fflags nobuffer -flags low_delay -rtsp_transport tcp
          roles:
            - record

...

ffmpeg:
  output_args:
    record: >
      -f segment  -segment_time 10
      -segment_format mp4
      -reset_timestamps 1
      -strftime 1
      -c:v av1_qsv
      -fps_mode passthrough
      -preset fast
      -global_quality:v 45
      -extbrc 1
      -look_ahead_depth 30
      -minrate 200k
      -maxrate 800k
      -bufsize 1.2M
      -refs 3
      -bf 4
      -g 600
      -keyint_min 60
      -c:a aac
      -b:a 32k
      -ac 1

But cannot apply a similar concept to the detect streams as I lose the HW filter support that the templates provide, and then even when I do specify the device against input_args, I need to update the filter anyway to include hwdownload,... into the filter graph.

I see many pathways here, including custom filter definitions, HW device specification, and/or complete ffmpeg command override.

At this point, I plan to either swap the mount in docker, or create a patch for the ffmpeg_presets.py where I can specify the device explicitly, but given that the Intel iGPU + Arc dGPU combination is probably quite common, am thinking it might be time to explore how we can configure a hybrid set of hwaccel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions