Skip to content

Support AMD GPU encoding #45

@tve

Description

@tve

I just got a new box with an integrated AMD GPU. Of course getting hardware encode/decode to work cost a bunch of hair off my head... I'm using linux, it's possible that the 'AMF' drivers on windows make things easier, dunno.

The simplest profile settings ASFAIK are:

  "vaapi": {
    "input": ["-hwaccel", "vaapi"],
    "output": ["-vcodec", "h264_vaapi"]
  },

The result is:

Impossible to convert between the formats supported by the filter 'Parsed_overlay_0' and the filter 'auto_scale_1'

which is ffmpeg's way to say that the output of the overlay filter can't be piped like that into the h264_vaapi encoder 'cause the latter expects the frame to be in the hardware/gpu. What's needed is a 'hwupload' filter that does the upload to the gpu memory. E.g., in FFMPEGOverlay instead of

            "-filter_complex", f"[0:v][1:v]overlay{filter_extra}",

it needs

            "-filter_complex", f"[0:v][1:v]overlay{filter_extra},hwupload",

nice, eh?

BTW, I noticed that ffmpeg has an overlay_vaapi filter, so this would mean the decoded video frames would stay in gpu, get overlaid, and then encoded. Sadly the AMD vaapi driver doesn't support that... I believe the Intel one might.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestffmpegpossibly-fixedMaybe fixed already, but I can't test it or would like confirmation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions