Skip to content

Hardware H.264 encode on Apple Silicon through a V4L2 stateful encoder backend #139

Open

Description

@AmbitiousRealism2025

Request

A V4L2 memory-to-memory (stateful) H.264 encoder backend in gliff-server, next to VA-API and Vulkan Video. On Apple Silicon that's the only way to reach hardware encoding.

Setup

  • Host: MacBook Pro M1 Max, Omarchy 4.5 (Arch Linux ARM), linux-aurora 7.2.11.aurora14, vulkan-aurora (Borealis Mesa 26.3.0-devel), Hyprland
  • Client: ThinkPad X1 Carbon 7th gen (Intel), Omarchy
  • gliff 0.4.3 on both ends

What happens today

gliff-probe all on the Mac:

FAIL VA-API H.264 encode: unsupported: no H.264 High encode entrypoint
FAIL Vulkan Video H.264 encode: no encoder (no VK_KHR_video_encode_h264 H.264 profile, or GLIFF_VK_ENCODE=0); the CPU tier will be used
PASS VA-API H.264 decode
FAIL GPU round trip failed (va-api: unsupported: no H.264 High encode entrypoint: unsupported: no H.264 High encode entrypoint); the CPU pipeline will be used

So the server encodes with OpenH264 on the CPU. Even with gliff --headless --server-bin 'gliff-server --video cpu --low-bandwidth', the session feels laggy from the Intel client.

Why V4L2

The M1's GPU has no video encoder. Encoding happens in a separate block (AVE), and nothing on this hardware exposes it through VA-API or Vulkan Video. aurora-silicon/linux already has an AVE driver that registers as a V4L2 stateful encoder:

When that ships for T6000, the encoder appears as a /dev/videoN M2M device (the kind ffmpeg drives with h264_v4l2m2m). gliff would still fall back to the CPU, because it has no backend for it. Decode on the same machines already goes through libva-v4l2request (see #111).

Related

#89 (taking blocking work off the session thread) should help input latency on the CPU path in the meantime.

I can test on an M1 Max once the encoder is enabled in linux-aurora.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions