Skip to content

HEVC Alpha

Phillippe Pelzer edited this page Nov 15, 2026 · 2 revisions

HEVC with alpha

Apple VideoToolbox writes HEVC video with a transparent background: iPhone and iPad recordings, Keynote and Motion exports, HEVC stickers. The file has one hvc1 track that carries two layers. Layer 0 is the colour. Layer 1 is the alpha.

FFmpeg 9.0 decodes that alpha layer itself. This build has one patch on top: ffprobe reports yuva420p for the stream, not only for the frames.

Since: v1.0.39.

What FFmpeg 9.0 already does

Two upstream changes are in FFmpeg 9.0. They keep the alpha layer when the decoder reads Apple's non-standard parameter extension, and they make the decoder pick the alpha pixel format. Without them the alpha layer is dropped and you get an opaque yuv420p picture.

The build script checks for both and skips them when they are there. It would apply them against an older FFmpeg. On 9.0 they are not part of this patch.

What this build adds

Upstream's stream parameters come from the file header. Probing never decodes a slice, so ffprobe -show_streams shows the base-layer format yuv420p, while -show_frames already shows yuva420p. The patch makes the header path report the alpha format as well.

Command Stock FFmpeg 9.0 This build
ffprobe -show_frames yuva420p yuva420p
ffprobe -show_streams yuv420p yuva420p

Only the advertised format changes. Hardware decoding negotiation is untouched.

Quick example

# The stream-level pixel format of an alpha file
ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt -of csv=p=0 alpha.mov

# Take the alpha plane out as a grayscale video
ffmpeg -i alpha.mov -vf alphaextract -c:v libx264 mask.mp4

The first command should print yuva420p (not run, see Verification).

Options

The patch adds no options.

Verification

This is the weakest-tested page. The project has no HEVC alpha sample in its release tests. This page follows scripts/59-hevc-alpha-layer.sh and scripts/includes/hevc-alpha-stream-pixfmt.patch. It was not run in this documentation pass.

The patch file can be deleted to fall back to upstream behaviour. See also the upstream ticket #7965.

Platform notes

The patch applies to every platform build.

Clone this wiki locally